Ubuntu 22.04
Sponsored Link

Puppet : Install2023/10/12

 

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:~#
wget https://apt.puppet.com/puppet7-release-jammy.deb

root@dlp:~#
dpkg -i puppet7-release-jammy.deb

Selecting previously unselected package puppet7-release.
(Reading database ... 74156 files and directories currently installed.)
Preparing to unpack puppet7-release-jammy.deb ...
Unpacking puppet7-release (7.0.0-14jammy) ...
Setting up puppet7-release (7.0.0-14jammy) ...

root@dlp:~#
apt update

root@dlp:~#
apt -y install puppetserver
root@dlp:~#
vi /etc/puppetlabs/puppet/puppet.conf
# add to the end

dns_alt_names = dlp.srv.world,dlp
# any [environment] name
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:~#
wget https://apt.puppet.com/puppet7-release-jammy.deb

root@node01:~#
dpkg -i puppet7-release-jammy.deb

Selecting previously unselected package puppet7-release.
(Reading database ... 74156 files and directories currently installed.)
Preparing to unpack puppet7-release-jammy.deb ...
Unpacking puppet7-release (7.0.0-14jammy) ...
Setting up puppet7-release (7.0.0-14jammy) ...

root@node01:~#
apt update

root@node01:~#
apt -y install puppet-agent
root@node01:~#
vi /etc/puppetlabs/puppet/puppet.conf
# add to the end

[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:~#
/opt/puppetlabs/server/bin/puppetserver ca list --all

Requested Certificates:
    node01.srv.world       (SHA256)  EA:C2:8E:1F:7C:A6:BA:78:30:89:A4:0E:AB:81:C9:42:B5:2F:9C:A9:48:DE:80:70:65:A6:D1:FE:C1:35:20:6A
Signed Certificates:
    dlp.srv.world       (SHA256)  B6:7B:AC:EF:08:20:C4:E9:C7:02:D4:43:33:5B:53:7D:1D:A1:F2:D6:51:2C:95:08:AF:A4:36:17:15:A1:3A:30       alt names: ["DNS:dlp.srv.world", "DNS:dlp", "DNS:dlp.srv.world"]        authorization extensions: [pp_cli_auth: true]

# sign

root@dlp:~#
/opt/puppetlabs/server/bin/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/puppetlabs/code/environments/production/manifests
root@dlp:~#
vi /etc/puppetlabs/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:~#
/opt/puppetlabs/bin/puppet apply /etc/puppetlabs/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