Posts

Showing posts with the label puppet

Complete Guide to Backup and Restore Puppet Master Serve

Puppet Master Server Backup Guide 1. Prepare for Backup Ensure you have working backups of the Primary , Replica , and Compilers . Before initiating the backup, stop the pe_databases module timers to prevent pg_repack from interfering: systemctl stop pe_databases-*.timer 2. Create Backup Run the backup command on the Primary server: sudo puppet-backup create --dir=<BACKUP_DIRECTORY> --name=<BACKUP_NAME> 3. Backup Secret Keys Secure the secret keys used by Orchestration and LDAP services: Orchestration: /etc/puppetlabs/orchestration-services/conf.d/secrets/ LDAP (if applicable): /etc/puppetlabs/console-services/conf.d/secrets/keys.json 4. Restart Database Timers systemctl start pe_databases-catalogs.timer pe_databases-facts.timer pe_databases-other.timer systemctl status pe_databases-*.timer Puppet Master Server Restore Guide 1. Stop Database Timers systemctl stop pe_databases-*.timer 2. Uninstall PE on the Restore Target sudo /opt/pupp...

Auto Sign Puppet Agent Certificates Without Manual Approval

How to Enable Autosign for Puppet Agents If you're looking to automate the certificate signing process for Puppet agents, follow these tested and verified steps based on a real support case. Step 1: Enable Autosign on the Primary Server Edit the Puppet configuration file on your Primary Server : sudo nano /etc/puppetlabs/puppet/puppet.conf Add line "autosign = true" under the [main] section: [main] certname = puppet-master.example.com server = puppet-master.example.com user = pe-puppet group = pe-puppet environment_timeout = 0 module_groups = base+pe_only autosign = true Save and exit the file. Step 2: Clean the Agent Certificate on Primary To remove any conflicting certificate on the primary server, run: puppetserver ca clean --certname agent-node.example.com Replace agent-node.example.com with your actual agent's FQDN. Step 3: Clean SSL Certs on the Agent Node Now go to the agent node and clean its certificates: puppet ssl cl...

Puppet Recovery Playbook: Fix Code Deploy Failures, File Sync Issues, and PCP Connection Errors

After a UID/GID mismatch and misconfigured file permissions disrupted multiple Puppet services, including pe-puppetserver and file-sync on a replica node, we performed a comprehensive recovery. This post documents all issues, exact errors, and the steps we took to fix them. Issues & Errors Encountered 1. Puppet Server Restart Failure Error: Execution error (FileAlreadyExistsException): /opt/puppetlabs/server/data/analytics/analytics Fix: mv /opt/puppetlabs/server/data/analytics/analytics /opt/puppetlabs/server/data/analytics/analytics.bak_wrong mkdir -p /opt/puppetlabs/server/data/analytics/analytics chown pe-puppet:pe-puppet /opt/puppetlabs/server/data/analytics/analytics chmod 750 /opt/puppetlabs/server/data/analytics/analytics 2. puppet code deploy Failed Error: invalid or unknown remote ssh hostkey Fix: sudo -u pe-puppet ssh-keyscan -p 443 ssh.github.com >> /var/opt/lib/pe-puppet/.ssh/known_hosts chmod 600 /var/opt/lib/pe-puppet/.ssh/known_hosts ch...

Puppet Code Deploy Troubleshooting & Resolution Guide

Initial Problem I was setting up Puppet Enterprise and trying to push code using the trusted puppet code deploy command. But instead of a clean deployment, I got this surprise: puppet code deploy --dry-run And boom — this lovely error shows up: [POST /deploys][500] Errors while collecting a list of environments to deploy (exit code: 1). ERROR -> failed to stat '/var/opt/lib/pe-puppet/.gitconfig' So... what gives? Turns out this issue is part permissions, part SSH trust, and part “who ran this command and as which user.” But don’t worry — I’ll walk through all root causes and their real-world fixes step by step. Root Cause #1: Directory Permission What Happened: The directory /var/opt/lib was locked down with drwx------ (700) and owned by root . User pe-puppet couldn’t even step inside it. Since r10k runs as pe-puppet , it failed trying to read .gitconfig . The Fix: chmod 711 /var/opt/lib Why: This lets pe-puppet enter the folder ...