Configure the primary server
The Puppet vRO Plug-in requires you install and configure a Puppet Enterprise (PE) 2018.1.0+ primary server, which can be done manually or with a module. Ensure it is accessible on the same network as the vRO appliance.
The easiest way to configure the primary server is using the puppetlabs/vra_puppet_plugin_prep module. The module helps you automatically configure SSH, creates an RBAC user, configures autosign, and installs puppet strings. You still need to classify nodes, create a rule, and add the primary server endpoint manually.
If you decide to use the module to set up your primary server, you can skip over the first four setup processes in this guide and proceed to Role class location.
-
Configuring ssh into the primary server with a password and running commands as root.
-
Creating an RBAC user on the primary server. Note as of plug-in version 3.2, RBAC permissions have changed.
- Configuring autosigning to use
challengePassword
in the CSR with a shared secret. - Installing puppet-strings.
-
Making sure role manifests are in the
<environment>/site/role/manifests
directory. -
Checking nodes are classified with the
trustes.extensions.pp_role
in the console or$trusted['pp_role']
in thesite.pp
.
- Configuring PE environment groups to use the
trused.extensions.pp_environment
fact.
Primary server shell access
The vRO Plug-in needs to be able to ssh into the primary server and run commands. You can run these commands as the root user or a non-root user with sudo.
- Root user ssh
- Enable root ssh access
- Non-root user ssh
- Create a local user on the primary server
- Enable ssh with password authentication
- Enable passwordless sudo for the user
An example set of the/etc/sudoers.d/user
file:## This file allows the vRO plugin user 'vro-plugin-user' to remove nodes that are destroyed in vRO/vRA. ## This file also disallows the user 'vro-plugin-user' from removing the primary server and other PE Internal certs. Defaults:vro-plugin-user !requiretty vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet config print * vro-plugin-user ALL = (root) NOPASSWD: !/opt/puppetlabs/bin/puppet config print *[[\:blank\:]]* vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet resource service puppet ensure=stopped vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/facter -p puppetversion vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/facter -p pe_server_version vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet agent -t vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet agent --test --color=false --detailed-exitcodes vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet node purge * vro-plugin-user ALL = (root) NOPASSWD: !/opt/puppetlabs/bin/puppet node purge *[[\:blank\:]]* vro-plugin-user ALL = (root) NOPASSWD: !/opt/puppetlabs/bin/puppet node purge pe-internal-mcollective-servers vro-plugin-user ALL = (root) NOPASSWD: !/opt/puppetlabs/bin/puppet node purge pe-internal-peadmin-mcollective-client vro-plugin-user ALL = (root) NOPASSWD: /bin/ls -1 /etc/puppetlabs/code/environments/ vro-plugin-user ALL = (root) NOPASSWD: /opt/puppetlabs/bin/puppet strings * vro-plugin-user ALL = (root) NOPASSWD: /bin/find /etc/puppetlabs/code/environments/*
Create an RBAC user
The vRO Plug-in uses an RBAC user to read console data. The username and password need to be the same as the ssh user.
Autosign configuration
The Puppet vRO Plug-in installs the PE agent on newly deployed nodes.
To avoid manually approving new agent certificates, you can automate this process securely with an autosigning policy. Use the vra_puppet_plugin_prep module to configure autosigning using a shared key when classified on the primary server.
If you want autosigning but don’t want to use the vra_puppet_plugin_prep module, you can configure the same shared-key autosigning manually. The csr_attributes.yaml contains the challengePassword
, which can be used inside the autosigning script to confirm that the certificate can be signed.
#!/opt/puppetlabs/puppet/bin/ruby
#
# A note on logging:
# This script's stderr and stdout are only shown at the DEBUG level
# of the primary server's logs. This means you won't see the error messages
# in puppetserver.log by default. All you'll see is the exit code.
#
# https://docs.puppet.com/puppet/latest/ssl_autosign.html#policy-executable-api
#
# Exit Codes:
# 0 - A matching challengePassword was found.
# 1 - No challengePassword was found.
# 2 - The wrong challengePassword was found.
#
require 'puppet/ssl'
csr = Puppet::SSL::CertificateRequest.from_s(STDIN.read)
valid_pass = 'SecretPassword'
if pass = csr.custom_attributes.find do |attribute|
['challengePassword', '1.2.840.113549.1.9.7'].include? attribute['oid']
end
else
puts 'No challengePassword found. Not automatically accepting the request.'
exit 1
end
if pass['value'] == valid_pass
exit 0
else
puts "challengePassword does not match: #{pass['value']}"
exit 2
end
Install Puppet strings
puppet resource package rgen provider=puppet_gem
puppet resource package puppet-strings provider=puppet_gem
The puppet-strings gem is responsible for populating the descriptions of the roles in vRA. The role classes need the @summary
tag to populate this section.
@summary
tag:# This role installs a MySQL database and sample data
#
# @summary MySQL database server on Linux with sample data
class role::linux_mysql_database {
include profile::linux_baseline
include profile::mysql
include profile::sample_data
}
Role class location
The Puppet vRO plugin is designed to populate the $trusted['pp_role']
fact with the role specified in the blueprint.
These roles are populated in the vRA UI by looking for
<environment>/site/role/manifests/**/*.pp
files. The files are then parsed
with puppet-strings
to populate a summary. Classes in other locations in the control repository
are not accessible to the Puppet configuration management item in the vRA blueprint. If you are
not using the enterprise version of vRA, you can populate any class by setting the
Puppet.RoleClass
property in the blueprint.
See the vRO/vRA property reference for more information.
Node classification
The vRO Plug-in populates the $trusted['pp_role']
fact with the
classname of the role from the request.
Use the $trusted['pp_role']
fact to classify the node
with the class. The reference implementation uses a node group for each role with a rule that matches the role to the
trusted.extensions.pp_role
fact.
trusted.extensions.pp_role = role::webserver
site.pp
for managing classification, you can leverage
the $trusted['pp_role']
for inclusion. For
example:if $trusted['pp_role'] and defined($trusted['pp_role']) {
include $trusted['pp_role']
}
Use the method that complies with your existing configuration.
Environment group configuration
The PE console is responsible for classifying the node into the correct environment.
In the vRO configuration, each node has the
$trusted['pp_environment']
fact populated with the environment configured in
vRA. Use the trusted.extensions.pp_environment
in the rules for your environment
groups. See the environment node group documentation for
instructions on creating environment node groups and the rules documentation for adding rules to the
environment node group.
trusted.extensions.pp_environment = development