What is Puppet? Puppet is a config management tool that helps automating, provisioning and mange the infrastructure using the puppet agent to connect to the server (master). The Files used by puppet to configure are saved in manifests.
What you will need is fully configured private DNS for your infrastructure providing forward and reverse zones. Otherwise you will have to resolv all names using entries in /etc/hosts which gets very hard to manage really fast. You will also need to have port 8140/tcp open in your server's firewall.
In my case, I'll be using the hostnames puppetmaster.archyslife.lan - 172.31.10.40 and client01.archyslife.lan - 172.31.10.50.
Important: There needs to be a dns-record (A) named puppet.yourdomain.tld which points to your master server.
If you are using FreeIPA and the integrated DNS, you can simply run:
First we will have to install the puppet repo with this command:
You can now start and enable the puppetserver by using systemd.
You can do that by running the following command:
Run this command on the master-server.
It's now time to create our first manifest on the master and test the connection.
you can immediatly fetch the published manifests on clients by running
Feel free to comment and / or suggest a topic.
What you will need is fully configured private DNS for your infrastructure providing forward and reverse zones. Otherwise you will have to resolv all names using entries in /etc/hosts which gets very hard to manage really fast. You will also need to have port 8140/tcp open in your server's firewall.
In my case, I'll be using the hostnames puppetmaster.archyslife.lan - 172.31.10.40 and client01.archyslife.lan - 172.31.10.50.
Important: There needs to be a dns-record (A) named puppet.yourdomain.tld which points to your master server.
If you are using FreeIPA and the integrated DNS, you can simply run:
With that said, let's get started.
ipa dnsrecord-add archyslife.lan puppet --a-ip-address=172.31.10.40
[archy@ipa01 ~]$
First we will have to install the puppet repo with this command:
With the repo installed, continue installing the puppetserver-package.
sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm
[archy@puppetmaster ~]$
By default puppet has 2GB RAM allocated for its Java-VM. If you want to change that, edit /etc/sysconfig/puppetserver to look like the following:
yum -y install puppetserver
[archy@puppetmaster ~]$
JAVA_ARGS="-Xms1g -Xmx1g"
save and exit.You can now start and enable the puppetserver by using systemd.
Make sure puppet is running as master.
sudo systemctl start puppetserver.service
[archy@puppetmaster ~]$
sudo systemctl enable puppetserver.service
[archy@puppetmaster ~]$
Now install the client to your client-machine.
sudo /opt/puppetlabs/bin/puppet master
[archy@puppetmaster ~]$
and activate it using the following command:
sudo yum -y install puppet-agent
[archy@puppetmaster ~]$
The clients are authenticated to the puppet server using certificates signed by the master-puppet server. In order to register a client to it, we will have to submit a signing request.
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
[archy@puppetmaster ~]$
You can do that by running the following command:
To make the registration process complete, we will have to sign the request and add the client.
sudo /opt/puppetlabs/bin/puppet agent --server puppetmaster.archyslife.lan --waitforcert 30 --test
[archy@puppetmaster ~]$
Run this command on the master-server.
to list the signing requests and
sudo /opt/puppetlabs/bin/puppet cert --list
[archy@puppetmaster ~]$
to sign the client and finish the registration.
/opt/puppetlabs/bin/puppet cert --sign client01.archyslife.lan
[archy@puppetmaster ~]$ sudo
It's now time to create our first manifest on the master and test the connection.
Content of the file:
vim /etc/puppetlabs/code/enviroments/production/manifests/hello_world.pp
[archy@puppetmaster ~]$ sudo
file {'/var/hello_world_puppet':
ensure => present,
mode => '0644',
content => "This file was created by using a puppet-manifest.\n",
}
Push the file to the clientsBy default, puppet fetches the configuration changes every 30 minutes,
/opt/puppetlabs/bin/puppet apply /etc/puppetlabs/code/enviroments/production/manifests/hello_world.pp
[archy@puppetmaster ~]$ sudo
you can immediatly fetch the published manifests on clients by running
And because we pushed our manifest earlier, there should be a new file created under /var named hello_world_puppet.
/opt/puppetlabs/bin/puppet agent --test
[archy@puppetmaster ~]$ sudo
Feel free to comment and / or suggest a topic.
Comments
Post a Comment