Ubuntu 24.04
Sponsored Link

Puppet : Install2024/07/25

 

Install and setup the Configuration management tool [Puppet].
It's possible to use it on a server with standalone though, however, the example here configures Puppet with server and client environment.

It's necessary to setup DNS or hosts settings to resolve names or IP address and also NTP settings first.

[1] Configure Puppet on Server Host.
root@dlp:~#
apt -y install puppet-master
root@dlp:~#
vi /etc/puppet/puppet.conf
# add to last line

dns_alt_names = dlp.srv.world,dlp
# any [environment] name you like
environment = production

[main]
certname = dlp.srv.world
server = dlp.srv.world

root@dlp:~#
systemctl enable --now puppetserver

[2] Configure Puppet on Client Host.
root@node01:~#
apt -y install puppet-agent
root@node01:~#
vi /etc/puppet/puppet.conf
# add to last line

[main]
certname = node01.srv.world
server = dlp.srv.world

[agent]
server = dlp.srv.world
ca_server = dlp.srv.world
# interval for applying catalogs on server
# if set [0], always applied
# default is 30 minutes if the value is not set
runinterval = 30m

root@node01:~#
systemctl enable --now puppet

[3] Enable certificate from Puppet Client on Puppet Server.
root@dlp:~#
puppetserver ca list --all

Requested Certificates:
    node01.srv.world       (SHA256)  6A:4D:3C:21:AD:35:CF:14:CA:48:F2:DC:EE:0F:A5:9C:FB:E1:BA:1E:40:B0:CC:35:50:A4:04:15:55:F2:6B:EE
Signed Certificates:
    dlp.srv.world       (SHA256)  DB:4D:0A:69:95:97:F9:6E:9B:BC:83:9F:77:EB:88:2F:0F:05:AB:D4:50:8A:BA:C9:5E:D9:7D:19:8C:34:75:99       alt names: ["DNS:dlp.srv.world", "DNS:dlp", "DNS:dlp.srv.world"]        authorization extensions: [pp_cli_auth: true]

# sign

root@dlp:~#
puppetserver ca sign --certname node01.srv.world

Successfully signed certificate request for node01.srv.world
[4] Verify Puppet Server and Client work normally to create a test manifest.
Puppet clients apply manifests on Puppet server for every 30 minutes by default, so wait for a moment to make sure the setting or if you'd like to make sure at once, reload Puppet Client daemon.
# create a directory for putting manifests
# for the name [production], specify the name set for [environment = ***] parameter in [puppet.conf]

root@dlp:~#
mkdir -p /etc/puppet/code/environments/production/manifests
root@dlp:~#
vi /etc/puppet/code/environments/production/manifests/site.pp
# for example, create a [testgroup]

group { 'testgroup':
  ensure => present,
  gid    => 2000,
}

# on Client host, reload puppet if you like to verify settings immediately

root@node01:~#
systemctl reload puppet
root@node01:~#
grep testgroup /etc/group

testgroup:x:2000:
[5] If you like to apply manifest manually on localhost, run like follows.
root@dlp:~#
puppet apply /etc/puppet/code/environments/production/manifests/site.pp

Notice: Compiled catalog for dlp.srv.world in environment production in 0.01 seconds
Notice: /Stage[main]/Main/Group[testgroup]/ensure: created
Notice: Applied catalog in 0.03 seconds
root@dlp:~#
grep testgroup /etc/group

testgroup:x:2000:
Matched Content