Warning |
---|
This is a work in progress... |
Creating a Puppet Master Server
For this Instruction I am using 2 Virtual Machines on Ubuntu 16.04 LTS
Code Block |
---|
|
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt-get update
sudo apt-get install |
...
Modifying the Memory Limit on Puppet Master
Puppet default memory use is 2GB edit the puppetserver file to change it to 512mb.
Code Block |
---|
|
sudo vi /etc/default/puppetserver |
Adjust the line
Code Block |
---|
|
# Modify this if you'd like to change the memory allocation, enable JMX, etc
JAVA_ARGS="-Xms2g -Xmx2g -XX:MaxPermSize=256m" |
to
Code Block |
---|
|
# Modify this if you'd like to change the memory allocation, enable JMX, etc
JAVA_ARGS="-Xms512m -Xmx512m -XX:MaxPermSize=256m" |
Defining the DNS for the Server
For the Puppet Agents to find the Puppet Master server the DNS needs to be defined in the configuration file.
Code Block |
---|
|
sudo vi /etc/puppetlabs/puppet/puppet.conf |
Add this to the end of the file since our server ip is 192.168.237.130 we will use this in our example.
Code Block |
---|
|
dns_alt_names = hostname,192.168.237.130
[main]
certname = 192.168.237.130
server = 192.168.237.130
environment = production
runinterval = 5m |
Start the Puppet Server and Enable Start on Reboot
Code Block |
---|
|
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true |
Should be followed by
Code Block |
---|
|
Notice: /Service[puppet]/ensure: ensure changed 'stopped' to 'running'
service { 'puppet':
ensure => 'running',
enable => 'true',
} |
Creating the Puppet Agent Node
Code Block |
---|
|
wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt-get update
sudo apt-get install puppet-agent |
Configuring the Config File to Find the Puppet Master Server
Code Block |
---|
|
sudo vi /etc/puppetlabs/puppet/puppet.conf
[main]
certname = puppetagent
server = 192.168.237.130
environment = production
runinterval = 20m |
Start the Puppet Agent
Code Block |
---|
|
sudo /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true
Notice: /Service[puppet]/ensure: ensure changed 'stopped' to 'running'
service { 'puppet':
ensure => 'running',
enable => 'true',
} |
Checking if the Puppet Agent CSR Reached the Puppet Master Server
On the Puppet Master server run this command to check if it has received the puppet agent CSR.
Code Block |
---|
|
setupadmin@bbsvc1:~$ sudo /opt/puppetlabs/bin/puppet cert list
"puppetagent" (SHA256) 52:3A:3A:13:EC:0C:1F:7D:EE:81:32:94:20:8F:DB:C8:9C:31:03:25:E2:A0:A6:8A:AE:DF:05:79:CC:7C:35:96 |
Now that you have confirmed the certificate sign it to connect the node.
Code Block |
---|
|
sudo /opt/puppetlabs/bin/puppet cert sign puppetagent
Signing Certificate Request for:
"puppetagent" (SHA256) 52:3A:3A:13:EC:0C:1F:7D:EE:81:32:94:20:8F:DB:C8:9C:31:03:25:E2:A0:A6:8A:AE:DF:05:79:CC:7C:35:96
Notice: Signed certificate request for puppetagent
Notice: Removing file Puppet::SSL::CertificateRequest puppetagent at '/etc/puppetlabs/puppet/ssl/ca/requests/puppetagent.pem' |
To check all certificates signed with the Puppet Master.
Code Block |
---|
|
sudo /opt/puppetlabs/bin/puppet cert list --all
+ "192.168.237.130" (SHA256) F0:98:99:57:FA:C3:91:19:D4:7C:DA:20:7C:B6:78:FD:87:FA:44:0D:B0:F4:A1:4C:20:2A:BB:56:4F:09:DB:BF (alt names: "DNS:192.168.237.130", "DNS:hostname", "DNS:192.168.237.130")
+ "puppetagent" (SHA256) ED:5C:43:36:69:6C:9F:9C:15:44:40:93:0D:3C:C4:64:7F:3D:78:CF:90:B0:2D:0B:AB:D1:6F:54:E5:34:EC:DA |
How to Execute Puppet Scripts
sudo puppet apply "puppet script"
Updating Ubuntu
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}
...