Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nvalentine-puppetlabs/dd385dcf81da25f4466b to your computer and use it in GitHub Desktop.
Save nvalentine-puppetlabs/dd385dcf81da25f4466b to your computer and use it in GitHub Desktop.
Puppet Code Deployment Workflow technical details

Note: 's/myorg//g' in text below.

Create a feature branch in control repo for devtesting redis code.

$ mkdir ~/workspace && cd workspace 
$ git pull git@git.myorg.com:myorg/puppet-control.git
$ cd puppet-control
$ git fetch --all && git checkout staging && git pull origin staging
$ git checkout -b redis_modules

Does the Puppet Forge have a suitable redis component module?

https://forge.puppetlabs.com

Create a repo to host component module: puppet-redis.

Via the GitLab web interface.

Add puppet-redis and ref to Puppetfile in control repo.

$ cd ~workspace/puppet-control
$ vi Puppetfile
...

If suitable Puppet Forge module:

mod '<namespace>/redis', '<some version>'

else:

mod 'redis',
  :git => 'git@git.myorg.com:myorg/puppet-redis',
  :ref => 'master'
$ git add -A && git commit -m 'add redis module to the Puppetfile' && git push origin redis_module

Local devtesting of redis component modules and profile.

Use of Vagrant and VMs or Docker containers highly advisable.

Push feature branch to repo + r10k deploy on Puppet Master

$ cd ~/workspace/puppet-redis
$ git push origin redis_module
$ ssh <puppetmaster>
puppetmaster$ sudo /opt/puppet/bin/r10k deploy environment redis_module -p --verbose
$ ssh <puppetagent>
puppetagent$ sudo puppet agent -t --noop --environment=redis_module

Inspect report of noop results.

puppetagent$ sudo puppet agent -t --environment=redis_module

Inspect convergence results.

Merge Request feature branch to 'staging' branch of control repo.

Via the GitLab interface.

Accept Merge Request + r10k deploy 'staging' on Puppet master.

Verify and accept Merge Request via GitLab interface.

$ ssh <puppetmaster>
puppetmaster$ sudo /opt/puppet/bin/r10k deploy environment staging -p --verbose
$ ssh <puppetagent>
puppetagent$ sudo puppet agent -t --noop --environment=staging
puppetagent$ sudo puppet agent -t --environment=staging

Merge Request 'staging' branch to 'production' branch of control repo.

Via GitLab interface.

Accept Merge Request + r10k deploy on 'production' on Puppet master

Verify and accept Merge Request via GitLab interface.

$ ssh <puppetmaster>
puppetmaster$ sudo /opt/puppet/bin/r10k deploy environment production -p --verbose
$ ssh <production puppet agent>
productionpuppetagent$ puppet agent -t --noop --environment=production
productionpuppetagent$ puppet agent -t --environment=production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment