Deploy module code
You can deploy new module code to your Puppet
environments via a Continuous Delivery for PE module pipeline. To do so, you must
first add a
:branch => :control_branch declaration to the module's entry
in your control repo's Puppetfile.
Module code is deployed to your Puppet environments using the eventual consistency deployment policy. When you trigger a module deployment, Continuous Delivery for PE creates a new branch in your module repository with the same name as your target Puppet environment. This new branch contains the code to be deployed.
Continuous Delivery for PE then triggers Code Manager, which
:branch => :control_branch declaration referring to
the module in the control repo's Puppetfile and adds the new module code to the
control repo. The new module code is now ready to be deployed to your chosen Puppet environments on the next scheduled Puppet run.
Open the Puppetfile that includes the module you wish to deploy. Add a
:branch => :control_branchdeclaration to the module's section of the Puppetfile, as in the following example.
To learn more about the
mod 'apache', :git => 'https://github.com/puppetlabs/puppetlabs-apache', :branch => :control_branch, :default_branch => 'main'
:branch => :control_branchoption, see Declare content from a relative control repo branch in the Code Manager documentation.
If you are running Puppet Enterprise version 2019.0.x
or any earlier version:
Add the following to the top of your Puppetfile:
def default_branch(default) begin match = /(.+)_(cdpe|cdpe_ia)_\d+$/.match(@librarian.environment.name) match ? match:default rescue default end end
Add the following
:default_branchentries to the module entry in your Puppetfile:
:branch => :control_branch, :default_branch => default_branch('main')
- Add the following to the top of your Puppetfile:
- In the Continuous Delivery for PE web UI, click Modules and select the module you wish to deploy.
- If you haven't already done so, create a pipeline for your module.
- Click + Add stage. Select Deployment.
- Select your PE instance and choose the Puppet environment the module code will be deployed to.
- Click Add deployment.