This Puppet module has sane defaults to keep a standard installation simple, but is flexible enough to support automatic updates, multiple installations of diferent versions, and running Puppet as a non-root user.
The golang
class installs Go under /usr/local/go/
, and symlinks
the binaries into /usr/local/bin/
.
include golang
By default it installs the latest version but never upgrades it after the
initial installation. You can set it to automatically upgrade by passing
latest
to ensure
, either with hiera
(golang::ensure: latest
), or with a class declaration:
class { 'golang':
ensure => latest,
}
You may force it to install a specific version by passing it to
ensure
:
class { 'golang':
ensure => '1.19.1',
}
Of course, you can also use ensure
to uninstall Go:
class { 'golang':
ensure => absent,
}
You can install Go in other places and as other users using the
golang::installation
defined type, and you can link its binaries into
a bin
directory with golang::linked_binaries
:
golang::installation { '/home/user/go-1.19.1':
ensure => '1.19.1',
owner => 'user',
group => 'user',
}
golang::linked_binaries { '/home/user/go-1.19.1':
into_bin => '/home/user/bin',
}
To install the latest version, set ensure => latest
on
golang::installation
. To remove the installation or symlinks, just use
ensure => absent
.
You can use the defined types to install Go even when running as a non-root
user. owner
and group
default to the user
and group running Puppet:
golang::installation { '/home/me/go':
ensure => latest,
}
golang::linked_binaries { '/home/me/go':
into_bin => '/home/me/bin',
}
This does not support Windows.
This is stable. I have no features planned for the future, though I’m open to suggestions.
I will occasionally make 0.0.1 releases to keep this updated with the latest version of PDK.
There is specific documentation for individual parameters in REFERENCE.md. That file is generated with:
pdk bundle exec puppet strings generate --format markdown