Transitioning from Puppet Launcher to RVC Puppet

Transitioning from Puppet Launcher to RVC Puppet

Scheduled Puppet runs on SC//Reliantâ„¢ nodes are moving from Puppet Launcher to the SC//Reliant Virtual Controller (RVC). After the transition, the scheduled task that runs Puppet on each node calls rvc puppet run instead of /opt/reliant/bin/puppet-launcher.sh. RVC then handles the random wait before the run, prevents overlapping runs, honors a disabled Puppet agent, and runs Puppet.

This topic describes what changes, how to tell which method a node uses, and what to do differently when you work with Puppet on a node.

Requirements

  • RVC version 3.12.0 or later is required on every node that uses RVC Puppet.
  • Some features require RVC version 3.13.0 or later: puppet.status, post-run hooks, cluster-wide runs, and the saved run output files in /var/log/puppetlabs/.
  • If a node is set to install an RVC version earlier than 3.12.0, Puppet can't compile the node's catalog after the transition, and the run fails with an error that asks you to raise the RVC version to at least 3.12.0. The whole catalog fails, not only the scheduled task. To fix it, set the RVC Version property for the node or its node group in SC//Reliant Platform Manager to 3.12.0 or later.

Upgrading RVC on a node doesn't switch the node to RVC Puppet by itself. A node can run RVC 3.12.0 or 3.13.0 and still use Puppet Launcher for its scheduled runs. Use the check below to see which method a node uses.

Check which method a node uses

The scheduled Puppet run is stored in the root crontab under the name run_puppet_script. Run the following command on the node:

sudo crontab -l | grep -A1 run_puppet_script

A node that uses Puppet Launcher returns:

# Puppet Name: run_puppet_script
0,30 * * * * /opt/reliant/bin/puppet-launcher.sh

A node that uses RVC Puppet returns:

# Puppet Name: run_puppet_script
0,30 * * * * if /usr/local/bin/rvc rvc state; then /usr/local/bin/rvc puppet run --random-wait=1800; else /opt/puppetlabs/bin/puppet agent -t; fi >/dev/null 2>&1

The schedule comes from the Cron Puppet Client Hours and Cron Puppet Client Minutes properties in SC//Reliant Platform Manager, and the --random-wait value comes from the Puppet Maxwait property. You can set these properties on a node, a node group, or a site. For descriptions of these properties, see Node group property reference. If Puppet Maxwait isn't set or isn't a number, 1800 seconds is used. If Puppet Maxwait is set to 0, see A Puppet Maxwait of 0 no longer means no wait. These are the same properties that Puppet Launcher uses, so a node's schedule and maximum wait don't change during the transition. The values in this example can differ from those on your nodes.

What changes

AreaPuppet LauncherRVC Puppet
Scheduled command/opt/reliant/bin/puppet-launcher.shrvc puppet run --random-wait=<puppet_maxwait>, or puppet agent -t when the RVC server isn't responding
ScheduleThe Cron Puppet Client Hours and Cron Puppet Client Minutes properties in SC//Reliant Platform ManagerUnchanged. Uses the same Cron Puppet Client Hours and Cron Puppet Client Minutes properties, and the crontab entry keeps the same name.
Random wait before a scheduled runA random sleep inside the launcher script, up to the Puppet Maxwait propertyThe --random-wait option, set from the same Puppet Maxwait property
RVC on the nodeInstalled only where assignedInstalled on every node
Masterless runspuppet-launcher.sh -mRemoved
Output of scheduled runssyslog, with the puppet-agent and puppet-launcher tagsThe RVC server journal. With RVC 3.13.0 or later, also /var/log/puppetlabs/last_execution.log.
Pausing Puppetpuppet-launcher.sh -d, or stopping the RVC serverrvc puppet disable --message="<reason>". The launcher's -d option still works. Stopping the RVC server no longer pauses Puppet.
Resuming Puppetpuppet-launcher.sh -ervc puppet enable. The launcher's -e option still works.

How scheduled runs work after the transition

Before each scheduled run, the scheduled task checks whether the RVC server is responding by running rvc rvc state. The result decides how Puppet runs:

State of the nodeWhat runs
The RVC server is respondingrvc puppet run with a random wait. This is the normal path.
The RVC server is responding, and a run is already pending or in progressrvc puppet run, which refuses to start because Puppet is busy. No second run starts.
The RVC server is responding, and Puppet is disabledrvc puppet run, which refuses to start. The node stays disabled.
The RVC server is stoppedpuppet agent -t, run directly
RVC isn't installed yet, such as on a newly bootstrapped nodepuppet agent -t, run directly

A direct puppet agent -t run also starts the RVC server again, and on a new node it installs RVC. Later scheduled runs then use RVC. Scheduled runs never use --force, so a node that was disabled on purpose stays disabled.

Common tasks

Run the following commands as root, for example with sudo.

TaskCommand
Run Puppet now, with no waitrvc puppet run
Run Puppet the way the schedule doesrvc puppet run --random-wait=<puppet_maxwait>, where <puppet_maxwait> is the node's Puppet Maxwait property value, for example 1800
Run Puppet even though it is disabledrvc puppet run --force
Pause Puppetrvc puppet disable --message="<reason>"
Resume Puppetrvc puppet enable
Check whether Puppet is disabledrvc puppet disabled?
Check whether a run is in progress, who disabled Puppet, and when the next run is scheduled (RVC 3.13.0 or later)rvc puppet status
Stop a run that was started through RVCrvc puppet stop
Check whether the RVC server is respondingrvc rvc state
Review the output of recent runsjournalctl -u rvc-server -n 100. With RVC 3.13.0 or later, also /var/log/puppetlabs/last_execution.log, and /var/log/puppetlabs/current_execution.log while a run is in progress.

To run Puppet immediately, leave out --random-wait. Setting --random-wait=0 doesn't skip the wait. Instead, RVC waits a random time up to the puppet_max_wait value in the RVC configuration file, which is 300 seconds by default. For details, see puppet.run.

Behavior differences to know

Stopping the RVC server no longer pauses Puppet

With RVC Puppet, a stopped RVC server causes the scheduled task to run puppet agent -t directly, which also starts the RVC server again. To pause Puppet on a node, use rvc puppet disable --message="<reason>" instead.

One run at a time

RVC allows only one pending or in-progress run on a node. While a run is waiting to start or running, another rvc puppet run is refused with Puppet busy running since <time> ago. and exits with code 1.

Disabling and enabling Puppet

  • rvc puppet disable requires a reason in --message. Without it, the command is rejected with Missing required argument: message.
  • While Puppet is disabled, rvc puppet run is refused with a message that includes the reason, and exits with code 1. With RVC 3.13.0 or later, the message also names the user who disabled Puppet.
  • Puppet can be disabled with rvc puppet disable, puppet agent --disable, or puppet-launcher.sh -d, and rvc puppet enable clears a disable made with any of them. rvc puppet status reports who disabled Puppet only when it was disabled with rvc puppet disable.
  • rvc puppet disabled? exits with code 0 whether Puppet is enabled or disabled. Check the returned true or false value rather than the exit code.

Stopping a run

rvc puppet stop stops only runs that were started through RVC. It doesn't stop a run started by Puppet Launcher or a puppet agent -t run started from a shell. For those runs, rvc puppet status reports the run as running, but rvc puppet stop responds with There is no puppet running. On a node that still uses Puppet Launcher, this means rvc puppet stop can't stop scheduled runs.

Exit codes of rvc puppet run

In RVC 3.12.0, rvc puppet run exits with the Puppet exit code, so a run that applied changes exits with code 2. In RVC 3.13.0, a completed run exits with code 0, and the Puppet exit code appears in the last line of the output, for example Puppet applied changes (exit code 2). A refused run, because Puppet is disabled or busy, exits with code 1 in both versions. Review any scripts that check the exit code of rvc puppet run when you upgrade RVC.

A Puppet Maxwait of 0 no longer means no wait

With Puppet Launcher, a Puppet Maxwait of 0 starts scheduled runs without a random wait. With RVC Puppet, RVC treats 0 as no value and uses its own default instead, so scheduled runs wait a random time of up to 300 seconds. To keep scheduled runs as close as possible to their scheduled time, set Puppet Maxwait to 1, which waits no more than 1 second.

Run output and logging

Puppet Launcher sent the Puppet agent's output to syslog. RVC doesn't, so Puppet messages from scheduled runs no longer appear in syslog under the puppet-agent and puppet-launcher tags. Review run output in the RVC server journal with journalctl -u rvc-server. With RVC 3.13.0 or later, the output of the most recent run is also saved to /var/log/puppetlabs/last_execution.log. Update any log filters or alerts that rely on the syslog tags.

Masterless runs are removed

The masterless mode of Puppet Launcher, puppet-launcher.sh -m, isn't available with RVC Puppet.

Troubleshooting

SymptomWhat to do
Puppet runs fail to compile the catalog with an error that RVC 3.12.0 or later is neededThe node is set to install an RVC version earlier than 3.12.0. Set the RVC Version property for the node or its node group in SC//Reliant Platform Manager to 3.12.0 or later.
Puppet busy running since <time> ago.A run is already pending or in progress. Wait for it to finish, or check it with rvc puppet status. A run started through RVC can be stopped with rvc puppet stop.
Puppet agent is currently disabled and will not run until it is manually enabled.Puppet was disabled on purpose. Check the reason in the message, then run rvc puppet enable, or use rvc puppet run --force for a single run.
rvc puppet stop returns There is no puppet running. while rvc puppet status shows a run in progressThe run wasn't started through RVC, for example a scheduled run from Puppet Launcher or a manual puppet agent -t run. Wait for the run to finish.
A run takes longer than expected to startThe run is in its random wait. To start a run immediately, run rvc puppet run without --random-wait.
Puppet messages are missing from syslogScheduled runs no longer log to syslog. Review the RVC server journal or /var/log/puppetlabs/last_execution.log.