Skip to content

Instantly share code, notes, and snippets.

@ananace
Created March 1, 2023 10:00
Show Gist options
  • Save ananace/05e8e46ad5e5fca3bb3ced3437e0c827 to your computer and use it in GitHub Desktop.
Save ananace/05e8e46ad5e5fca3bb3ced3437e0c827 to your computer and use it in GitHub Desktop.
Faking an AIO install for modern Puppet on Raspberry Pi
class profiles::raspberry_pi::fake_aio {
file {
default:
ensure => file;
'/etc/facter/facts.d/aio_agent_version.txt':
content => "aio_agent_version=${fact('puppetversion')}";
'/etc/facter/facts.d/aio_fake_agent.txt':
content => "aio_fake_agent=true";
}
file {
'/opt/puppetlabs/bin':
ensure => directory;
'/opt/puppetlabs/puppet/bin':
ensure => directory;
'/opt/puppetlabs/puppet/lib':
ensure => directory;
'/opt/puppetlabs/bin/puppet':
ensure => link,
target => '/usr/local/bin/puppet';
'/opt/puppetlabs/puppet/bin/gem':
ensure => link,
target => '/usr/bin/gem';
'/opt/puppetlabs/puppet/bin/ruby':
ensure => link,
target => '/usr/bin/ruby';
'/opt/puppetlabs/puppet/lib/pkgconfig':
ensure => link,
target => '/usr/lib/pkgconfig/';
}
ensure_packages([
'pkgconf', 'ruby-augeas',
])
package { 'RPi puppet gem':
name => 'puppet',
ensure => 'latest',
provider => 'gem',
notify => Service['puppet'],
}
systemd::unit_file { 'puppet.service':
ensure => present,
content => @(EOF),
[Unit]
Description=Puppet agent
Wants=basic.target
After=basic.target network.target
[Service]
EnvironmentFile=-/etc/sysconfig/puppetagent
EnvironmentFile=-/etc/sysconfig/puppet
EnvironmentFile=-/etc/default/puppet
ExecStart=/usr/local/bin/puppet agent $PUPPET_EXTRA_OPTS --no-daemonize
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
[Install]
WantedBy=multi-user.target
|-EOF
notify => Service['puppet'],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment