Deploy module code

You can use a Continuous Delivery module pipeline to deploy new module code to your Puppet environments. To do this, you must add a :branch => :control_branch declaration to the module's entry in your control repo's Puppetfile.

Continuous Delivery uses the Eventual consistency policy to deploy module code to your Puppet environments. When you trigger a module code deployment, Continuous Delivery creates a new branch in your module repository with the same name as your target Puppet environment. This new branch contains the module code you want to deploy. Then, Continuous Delivery triggers Code Manager. Code Manager reads the module's :branch => :control_branch declaration in the control repo's Puppetfile and adds the new module code to the control repo. The new module code is delivered to each node in the specified Puppet environment during each node's next scheduled Puppet run.

  1. Open the Puppetfile that includes the module you want to deploy. Add a :branch => :control_branch declaration to the module's section of the Puppetfile. For example:
    mod 'apache',
      :git    => '',
      :branch => :control_branch, 
      :default_branch => 'main'

    To learn more about the :branch => :control_branch declaration, refer to Declare content from a relative control repo branch in PE's Code Manager documentation.

  2. If you are running PE version 2019.0.z or earlier: You must make two additional changes to the Puppetfile.
    1. Add the following code to the top of the Puppetfile:
      def default_branch(default)
          match = /(.+)_(cdpe|cdpe_ia)_\d+$/.match(
          match ? match[1]:default
    2. Add the following :branch and :default_branch entries to the module's entry in the Puppetfile:
      :branch => :control_branch,
      :default_branch => default_branch('main')
  3. In the Continuous Delivery web UI, go to Modules and select the module you want deploy.
  4. If you haven't already done so, Create a pipeline for your module.
  5. Click Add stage and select Deployment.
  6. Select your PE instance and choose the Puppet environment where you want to deploy the module code.
  7. Click Add deployment.
Your module pipeline can now deploy new module code to the chosen Puppet environments when the pipeline is triggered.