pipeline { agent any environment { ANSIBLE_FORCE_COLOR = '1' SATURN_BEHEMOTH = credentials('SATURN_BEHEMOTH') LINUX_LDAP_PWD = credentials('LINUX_LDAP') AUTHORIZED_KEY = credentials('AUTH_SSH_KEY') matt_public_key = credentials('matt_public_key') matt_private_key = credentials('matt_private_key') cosmos_password = credentials('cosmos_password') cosmos_root_password = credentials('cosmos_root_password') EMAIL_RECIPIENTS = "matt@theregion.beer" } options { ansiColor('xterm') } stages { stage('Ansible Playbook') { steps { //Run the pxe-server ansible playbook // /workspace/ansible/playbooks/pxe-server.yaml sh """ set +x inventory_file="/var/jenkins_home/ansible/inventory/automation/pxe.yaml" playbook_file="/var/jenkins_home/ansible/playbooks/pxe-server.yaml" extra_vars=\$(echo " \ new_hostname=debian-pxe.home.cosmos \ saturn_behemoth=${SATURN_BEHEMOTH} \ authorized_key=${AUTHORIZED_KEY} \ rename_host=true \ matt_public_key='${env.matt_public_key}' \ cosmos_password='${env.cosmos_password}' \ cosmos_root_password='${env.cosmos_root_password}' \ quick_refresh='false' \ refresh_special='false' \ " | tr -s " ") set -x cd /var/jenkins_home/ansible ansible-playbook -i \$inventory_file \$playbook_file \ --ssh-common-args='-o StrictHostKeyChecking=no' \ --extra-vars "\$extra_vars matt_private_key='${env.matt_private_key}' """ } } } }