Over a million developers have joined DZone.

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

DZone's Guide to

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

· DevOps Zone ·
Free Resource

Get the fastest log management and analysis with Graylog open source or enterprise edition free up to 5GB per day

This post was originally written by Ron Zavner

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

Cloudify is an open source cloud orchestration framework that natively integrates with common configuration management tools, such as Puppet and Chef. Cloudify runs between the application and the cloud you choose to work with and facilitates auto-scaling and auto-recovery in the post-deployment phase. 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.

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.

Courtesy: Slashroot.In

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: localhost.localdomain localhost puppet

On the agent: 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.

Get the fastest log management and analysis with Graylog open source or enterprise edition free up to 5GB per day


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}