A tool for automating a workflow to adopt Puppet modules from the Puppet Forge without the need to write Puppet code.
puppet adopter module <module name>
Example Run
[root@master ~]# puppet adopter module puppetlabs-ntp
Notice: Preparing to run experiment for module 'puppetlabs-ntp'
Notice: Installing Modules...
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppetlabs.com ...
Notice: Installing -- do not interrupt ...
Could not find group with the name Adopter Experiment: ntp
Notice: Creating new group for experiment...
Notice: Check classification for "Adopter Experiment: ntp" in the Enterprise Console before continuing
Notice: Navigate a browser to https://master.puppetlabs.vm/#/node_groups/groups/f1fd495d-f570-4a3e-9336-b6bca10367fe
When you are ready, press enter to continue:
Notice: Starting Puppet Agent runs on experiment population
Nodes Complete: |==============================================================|
Notice: Puppet Agent runs completed
Total Variations Discovered: 2
Variation 1
Total Events: 3
Total Nodes: 1
---
Event - Service[ntp]
Proporty: ensure
Old Value: stopped
NewValue: running
Message: current_value stopped, should be running (noop)
---
Event - File[/etc/ntp.conf]
Proporty: ensure
Old Value: absent
NewValue: file
Message: current_value absent, should be file (noop)
---
Event - Package[ntp]
Proporty: ensure
Old Value: purged
NewValue: present
Message: current_value purged, should be present (noop)
---
Nodes:
master.puppetlabs.vm
-----------------END VARIATION 1-------------
Variation 2
Total Events: 2
Total Nodes: 2
---
Event - Service[ntp]
Proporty: ensure
Old Value: stopped
NewValue: running
Message: current_value stopped, should be running (noop)
---
Event - File[/etc/ntp.conf]
Proporty: content
Old Value: {md5}dc9e5754ad2bb6f6c32b954c04431d0a
NewValue: {md5}1f44e40bd99abd89f0a209e823285332
Message: current_value {md5}dc9e5754ad2bb6f6c32b954c04431d0a, should be {md5}1f44e40bd99abd89f0a209e823285332 (noop)
---
Nodes:
agent1.puppetlabs.vm
agent2.puppetlabs.vm
-----------------END VARIATION 2-------------
[root@master ~]#
The workflow explained below is a high-level description of the workflow that has been automated by this tool.
This tool will ultimately automate almost all of the steps in the process above. If used correctly, steps 2, most of 3, 4,5,6, and 7 will by handled by this tool.
When this tool is run, the following things will be done:
The steps below are initial installation steps for this tool while it is still in a development phase.
Eventually this will be hosted on the forge, so you can install just with:
puppet module install puppetlabs-adopt
In the mean time you'll need to git clone:
cd /etc/puppetlabs/code/modules`
git clone https://github.com/trlinkin/puppet-adopt.git adopt`
Create a configuration file in /etc/puppetlabs/puppet/adopter.yaml to specify the servers that host the PuppetDB and the Node Classifier in a split install. If this file is not present, a monolithic installed would be assumed and PDB and NC hosts will default to the master.
---
pdb_host: "puppetdb.puppet.vm"
nc_host: "console.puppet.vm"
A Number of Gems will need to be installed into Puppet Enterprise for this tool to function. This is automated in the adopt module, but if you choose to do a manual install, these are the steps to follow:
Gems installed into PE Agent Ruby
/opt/puppetlabs/puppet/bin/gem install puppetclassify
/opt/puppetlabs/puppet/bin/gem install puppetdb-ruby
/opt/puppetlabs/puppet/bin/gem install pcp-client
/opt/puppetlabs/puppet/bin/gem install inquirer
/opt/puppetlabs/puppet/bin/gem install ruby-progressbar
Gems installed into the PuppetServer JRuby
/opt/puppetlabs/bin/puppetserver gem install puppetclassify
pe-puppetserver
service after installationcd /etc/puppetlabs/code/modules
git clone https://github.com/trlinkin/trlinkin-noop.git noop
cd noop
git checkout noop_from_console
/etc/puppetlabs/code/environments/production/manifests/site.pp
for
editingnoop_from_console('noop')
The PCP Broker will need to allow the tool to orchestrate Puppet Agent runs on the nodes in our test population. We will need to configure the Broker to allow these messages to be sent.
/etc/puppetlabs/orchestration-services/conf.d/authorization.conf
{
"allow" : [
"pe-internal-dashboard",
"pe-internal-orchestrator",
"master.puppetlabs.vm"
],
"match-request" : {
"path" : "/pcp-broker/send",
"query-params" : {
"message_type" : [
"http://puppetlabs.com/rpc_non_blocking_request",
"http://puppetlabs.com/rpc_blocking_request"
]
},
"type" : "path"
},
"name" : "adopter pxp commands",
"sort-order" : 300
}
,
pe-orchestration-services
service for the rule to take effect