How Do You Deploy Docker to RedHat Linux Servers Using Puppet?

Problem scenario
You want to use Puppet to deploy Docker to a RHEL server in AWS.  How do you do this?

Warning: This may not work for Puppet versions 5 or higher. It should work for Puppet version 4 or lower. This solution is not a best practice.  It is quick way to deploy a version of Docker made for CentOS to RHEL instances.  It demonstrates transferring a file with Puppet.  This solution is for educational purposes only.

1.  Install Puppet master on a RedHat Server.  For directions, see this link.
2.  Install Puppet agent on a different RedHat server.  For directions, see this link.
3.  On the Puppet Master server, run this command (taken from this link):
puppet module install puppetlabs-docker_platform --version 2.2.1

4.  On the Puppet Master server, go to /etc/puppet/module/docker/.  Create a directory named "files".
5.  Still on the Puppet Master server, in the "files" directory, create a file named "docker.repo" with the following content:

name=Docker Repository

6.  Still on the Puppet master server, go to /etc/puppet/manifests/.  Modify site.pp to have these stanzas:

file { '/etc/yum.repos.d/docker.repo':
   mode => '0644',
   source => 'puppet:///modules/docker/docker.repo',
 exec { 'install_docker':
    command => "/bin/yum -y install docker-engine"

7.  On the Puppet Agent server, run this:  puppet agent -t -d

Leave a comment

Your email address will not be published. Required fields are marked *