Deploying the new environment on the Puppet Master

Puppet provides the PE Client Tools, as described in Chapter 5, Managing Code, specifically for deploying code. If these tools are not available on your workstation, you can also log in to the Puppet Master, where they are already available for use. Assuming that you are using Code Manager, the following steps remain the same whether you are on a local workstation or a remote server:

  1. Retrieve the login token from Puppet Enterprise (puppet-access login).
  2. Deploy an environment from the upstream repository branch (puppet-code deploy):
# If PE Client Tools are not installed locally, the Puppet Master comes with them
# installed by default. We'll assume that the PE client tools are not already
# installed and log in to the Puppet Master
ssh [email protected]

# Generate an authorization token to allow your PE Console user to deploy code
puppet-access login

# Use our access token to deploy our new environment. Notice the -w flag, which
# triggers the client tools to wait and give you a pass or fail message on the
# status of the deployment.
puppet-code deploy new_feature -w

Now our code has been deployed as a fresh environment on the Puppet Master. We're still missing a step to classify our test system and ensure that it is placed in the proper environment. For a Puppet Enterprise user, you can both classify and declare an environment by using a node classifier group in the PE console. To create a new node group, select an environment, check the environment group box, name it, and click Create. Enter your new environment group, pin your test node to the group, and add any relevant classes to the classification page.

You can also classify via manifests/site.pp in the control repository, as follows:

node 'test.node' {
include relevant_role_or_profile
include new_feature
}

The code for classification via Hiera is as follows:

# data/host/test.node.yaml
---
classification:
- relevant_role_or_profile
- new_feature

# manifests/site.pp

# Notice the lack of a node group around the include statement
include $::classification

There are multiple ways to classify that are commonly used by Puppet users, but without automated testing, we'll have to do some classification and run the agent to check the results of our tests. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.66.178