Intro to Puppet, Installing your First MySQL Service in 5 Minutes

Posted By: Ron Zavner on January 23, 2014


Puppet, a popular configuration management tool is used by many IT companies to help facilitate and automate the setup of environments.

We'll discuss Cloudify in this context from a cloud orchestration perspective - running between the application and the cloud you choose to work with and help in 3 different phases - pre-deployment, deployment, and post-deployment, including auto-scaling and auto-recovery. While Cloudify does support configuration management out of the box too, it integrates seamless with all the popular CM tools in order to take advantage of in-house know-how of existing tools.


Beyond simple automation - orchestration to the max. Test drive Cloudify.     Go


Puppet enables sysadmins and DevOps teams to automate their daily repetitive tasks using code. These tasks include installing new software, upgrades, managing user accounts, and such.

Usually, Puppet is used with a client server topology - the Puppet master server which contains the modules and manifests and then other machines with Puppet agents that interact with the Puppet server.

Then if, for example, you have an application with Apache load balancer, a few Tomcat instances and a MySQL instance, you would probably have one VM for each instance with a Puppet agent installed. This agent will interact with the Puppet Master which can provide the required module to install the actual service.

 

The Puppet Agent first signs in to the Puppet Master and gets a certificate (you can either approve/reject this cert sign request in the Puppet Master or choose to autosign some or all of these requests). The Puppet Master then needs to provide the manifests for installation either based on the node information (host name for example) or an external classifier plugin.

Common Shell Scripts for Puppet Installation - A Step by Step Guide

Installing and working with Puppet is made really easy using these scripts. Below are the steps to configure your Puppet installation:

Install Puppet Master on machine one

sudo apt-get install puppetmaster

Install Puppet Agent on machine two

sudo apt-get install puppet

Configure the etc/hosts file on both machines so they will be able to communicate with each other. On the master:

127.0.0.1 localhost.localdomain localhost puppet

On the agent:

192.168.1.8 puppetagent.example.com puppetagent puppet

Connect to the Puppet Master machine and search for MySQL module:

sudo puppet module search mysql

Install the MySQL module:

sudo puppet module install puppetlabs-mysql

NOTE: Verify that a new MySQL directory was created under /etc/puppet/modules for this step.

Create a site.pp file under /etc/puppet/manifests and add the following piece (replace the node name with the actual one - this will tell Puppet to install MySQL on that specific node):

node 'ip-10-151-40-34.ec2.internal' { include mysql::server }

Start the Puppet Master process:

sudo /etc/init.d/puppetmaster restart

Connect to the Puppet Agent machine and start the Puppet Agent service:

sudo /etc/init.d/puppet start

Then go back to the Puppet Master and review the cert requests:

sudo puppet cert list

Now you can sign this agent request or all of them:

sudo puppet cert sign --all

 

That's it, your MySQL service should be up and running.  If you type top you should be able to see it.

blog comments powered by Disqus