047 Puppet Ig v1.0
047 Puppet Ig v1.0
047 Puppet Ig v1.0
co/
Puppet
Installation Guide
Version 1.0
Installation Guide www.edureka.co/
Installation
Setting up Vagrant
You will need vagrant to set up a virtual box for master slave configuration. You
can do this only when we come to the portion on master slave.
The complete instructions for same can be found here:
» http://www.edureka.co/blog/development-environment-using-vagrant/
» And here: http://www.edureka.co/blog/10-steps-to-create-multiple-vms-
using-vagrant/
##Enable Repos
##YUM Systems
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
dpkg -i puppetlabs-release-trusty.deb
apt-get update
[main]
Cert=puppet
dns_alt_names = demo1,demo1.sridemo.com
#Restart Server
TIP: Before doing any installation and restart, ensure first ensure
DNS has been set up correctly (See Class notes for DNS setup)
Edit /etc/hosts and /etc/hostname and ensure correct hostname has been set (also use
hostname command to set this correctly.
For client, the same setup is required. Here are the full steps:
#### For latest versions, you still need to get the DEB/YUM package and install it..
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
rm -rf /var/lib/puppet
rm -rf /var/run/puppet
# for YUM
#touch /etc/puppet/auth.conf
[agent]
server = demo1.sridemo.com
#Restart client
[agent]
server = demo1.sridemo.com
#Restart client
TIP: when you install the puppet client, by default, it will create a section called
[master]. Rename this to [agent] instead manually.
Now on client, verify you can reach your master and type the following command:
puppet agent -t
puppet cert list –all # you should see your new client listed up without a + sign
puppet cert list –all # you should see your new client listed up with a + sign
Now on client, verify you can reach your master and type the following command:
puppet agent -t
Hiera setup
### Hiera is automatically installed with Puppet 3.8.7
## from a command line
hiera ntp_server
hiera ntp_server --yaml web01.example.com.yaml
## The config file is found here /etc/puppet/code/hiera.yaml (or /etc/puppetlabs/code/hiera.yaml. For
Hiera 1,
NOTE: to test this from command line, the file hiera.yaml has to be present in /etc. instead of copying
the file, link it as below:
ln -s /etc/puppet/hiera.yaml /etc/hiera.yaml
Without this step, command line testing for hiera will not work.
## Sample hiera.yaml file.
---
:backends:
- yaml
- json
:yaml:
:datadir: /etc/puppet/hieradata
:json:
:datadir: /etc/puppet/hieradata
:hierarchy:
- node/%{::fqdn}
- "%{::environment}"
- common
Download links:
Common.yaml - https://edureka.wistia.com/medias/oag2wfcae4/download?media_file_id=135866149
Stagin.yaml - https://edureka.wistia.com/medias/ybzepruw8i/download?media_file_id=135866161
Devweb01.sridemo.com.yaml -
https://edureka.wistia.com/medias/cvh4du2yqi/download?media_file_id=135866148
Installing ActiveMQ
#installing ActiveMQ
## to install ActiveMQ, first install Java
# Next
wget https://archive.apache.org/dist/activemq/5.11.2/apache-activemq-5.11.2-bin.tar.gz
cd [activemq_install_dir]
#From a command shell, change to the installation directory and run ActiveMQ as a foregroud process:
cd [activemq_install_dir]/bin
./activemq console
#From a command shell, change to the installation directory and run ActiveMQ as a daemon process:
cd [activemq_install_dir]/bin
./activemq start
#If all is installed correctly you should see something like below:
TIP: It is recommended to use puppet to install mcollective on the nodes to be managed. Sample code is
below:
class mcollective {
# Install
package {'mcollective':
ensure => latest,
}
# Run
service {'mcollective':
ensure => running,
enable => true,
require => Package['mcollective'],
}
TIP: If libdir specified in server.cfg or client.cfg does not exist, create one as
mkdir -p /usr/share/mcollective/plugins
Interesting commands:
mco find
mco ping
mco inventory <hostname>
mco rpc rpcutil agent_inventory -I some.node
mco rpc service start service=apache2
mco plugin doc service
mco rpc service status service=apache2
mco rpc service status service=httpd -S "environment=development or customer=acme"
mco ping -A service
mco ping -C apache2
mco ping -C /service/
mco ping -F "country=/uk|us/"
mco ping -I dev1 -I dev2
mco ping -I dev1 -I dev2
mco ping -I /sridemo.com$/
mco ping -S "((customer=acme and environment=staging) or environment=development) and /apache/"
mco ping -S "environment=development and !customer=acme"
mco ping -S "environment=development and not customer=acme"
mco ping -S "fstat('/etc/hosts').md5=/baa3772104/ and environment=development"
mco rpc nrpe runcommand command=check_load -I dev1 -v #see data verbose
mco rpc nrpe runcommand command=check_load -I dev1 -j # see in JSON format
mco package status kernel
See this link: http://workblog.intothenevernever.com/?p=127 for exposing facts between mcollective and
puppet.
Install Apache 2
If you’re running Puppet 3.x, make sure the always_cache_features setting is set to true
in the [master] (not [main]) section of puppet.conf. This improves performance.
In post-4.0 versions of Puppet, the example config.ru file hardcodes this setting to true.
Make sure Apache’s KeepAliveTimeout setting is set to at least 5. (5 is the default value,
but your global Apache config may have set a different value, in which case you’ll need
to change it.)
Although this setting is valid at virtual host scope, the way Apache reads its value means
it’s safer to set it globally.
Puppet includes a config.ru file, which tells Rack how to spawn Puppet master processes.
To install this Rack application in a form Passenger can use, you’ll need to:
» Create three directories for the application (a parent directory, a “public”
directory, and a “tmp” directory)
» Copy the ext/rack/config.ru file from the Puppet source code into the parent
directory
Download link:
https://edureka.wistia.com/medias/l482wx3ps9/download?media_file_id=135866837
Adjust paths and permissions as required
On Debian
RHEL/CentOS:
RHEL/CentOS:
If all works well, you’ll want to make sure the WEBrick service no longer starts on boot:
Debian/Ubuntu:
RHEL/CentOS:
If all goes ok, apache2 should be run (we added our own index.html) and puppetmaster
should run as an Apache2 application and custom facts should still run
A much easier way is to install Passenger separately along with Apache. Next install
puppet gems and that’s it. In both cases, pay close attention to PassengerUser (it
should be set to puppet (if not already set)) and the config.ru file should be accessible
by this user