Hi Jeff,

I've recently added support for MSI and executable packages on
Windows[1], which will be out in Puppet 3. That way you can just
download the java exe installer (step 1) and manage it via a `package`
resource, thereby avoiding the zip issue. Obviously, it doesn't help
you out now.

In 2.7.x, I'd recommend using one of the later puppet versions as the
MSI support is much better[2]

On Thu, Aug 16, 2012 at 1:45 PM, Jeff Sussna <j...@ingineering.it> wrote:
> Thanks for the pointer to nanliu/staging. Though from the forge page it
> sounds like it requires a master and hiera. I'm running standalone.

You can install and run modules locally, e.g.

puppet apply <manifest> --modulepath <path>

In 2.7.x, make sure to use forward slashes for the module path[3]

>
> Re env vars, I managed to figure that out. The following resource sets the
> global system var FOO_BAR to the current value of PATH, with ";baz" appended
> to the end of it:
>
> exec { "cmd.exe /c reg add \"HKLM\SYSTEM\CurrentControlSet\Control\Session
> Manager\Environment\" /v FOO_BAR /t REG_SZ /d \"$::path;baz\" /f":
>      path => $::path
> }
>

You'll need to add an `unless` otherwise puppet will append baz each
time it runs.

> Note the escaped quotes.
>
> On Windows 7 you could use the builtin 'setx' command instead, but I'm being
> wacky and using Puppet on XP, which doesn't have setx.

Didn't know about setx, cool!

>
> On Thursday, August 16, 2012 3:20:11 PM UTC-5, Ryan Coleman wrote:
>>
>> On Thu, Aug 16, 2012 at 12:44 PM, Jeff Sussna <j...@ingineering.it> wrote:
>> > I want to use Puppet to manage Groovy and Gradle on Windows machines.
>> > The
>> > install process for each looks like:
>> >
>> > 1. Download zip file from a URL

If you can host the package on a puppet fileserver, then you can just
use a 'puppet' URI scheme.

If not, then you'll have to use nan's module (which requires curl) to download.

>> > 2. Unzip
>>
>> The nanliu/staging module on the Puppet Forge will at least get you
>> the first two points. http://forge.puppetlabs.com/nanliu/staging
>>
>> With a couple of Puppet resources, it will retrieve the zip file from
>> a url, store it somewhere and unzip it wherever you want. He lists
>> some examples on the Forge page. They're for tar.gz files but the
>> resources automatically handle zipped files should they have the
>> proper .zip extension.
>>

Nan's module requires unzip, which isn't present by default. You'd
probably want to install 7zip. They have an MSI installer, so you can
manage as a package resource.

>> > 3. Create a Windows environment variable to point to the location where
>> > you
>> > unzipped

You can exec reg.exe or use the registry module[4][5]:

So to create an environment variable JAVA_HOME=C:\java7, you'd do:

registry_value { 'HKLM\System\CurrentControlSet\Control\Session
Manager\Environment\JAVA_HOME':
  ensure => present,
  type     => string,
  value   => 'C:\java7'
}

The `registry_value` type supports all common registry types, such as
REG_EXPAND_SZ, so you can do `value => '%SYSTEMDRIVE%\java7'`

>> > 4. Add that environment variable/bin to the global PATH environment
>> > variable.
>>
>> I'm sorry I can't help you with these two. Hopefully someone else on
>> the list can. :-)
>

This would best be handled by an environment type & provider (to
account for the inclusive/exclusive behavior of the multi-valued PATH
environment variable). In the meantime, probably best to use the exec
resource.

Josh

[1] http://projects.puppetlabs.com/issues/11870
[2] http://projects.puppetlabs.com/issues/11868
[3] http://projects.puppetlabs.com/issues/13055
[4] http://forge.puppetlabs.com/puppetlabs/registry
[5] http://puppetlabs.com/blog/module-of-the-week-puppetlabs-registry-windows/

-- 
Josh Cooper
Developer, Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to