init commit
This commit is contained in:
55
Jenkinsfile.matt-profile-capture
Normal file
55
Jenkinsfile.matt-profile-capture
Normal file
@ -0,0 +1,55 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
// Define parameters
|
||||
parameters {
|
||||
string(name: 'host_ip', description: 'Target System Address')
|
||||
}
|
||||
|
||||
environment {
|
||||
ANSIBLE_FORCE_COLOR = '1'
|
||||
SSH_CREDENTIALS_ID = 'jenkins-ssh-key'
|
||||
SATURN_BEHEMOTH = credentials('SATURN_BEHEMOTH')
|
||||
}
|
||||
options {
|
||||
ansiColor('xterm')
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
|
||||
stage('Generate Inventory File') {
|
||||
steps {
|
||||
// Generate the dynamic inventory file
|
||||
sh """
|
||||
cd /var/jenkins_home/ansible
|
||||
chmod +x /var/jenkins_home/ansible/inventory/generate_inventory.sh
|
||||
/var/jenkins_home/ansible/inventory/generate_inventory.sh ${params.host_ip}
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Ansible Pipeline') {
|
||||
steps {
|
||||
//Run the cosmos-base ansible playbook
|
||||
sh """
|
||||
cd /var/jenkins_home/ansible
|
||||
|
||||
ansible-playbook -i /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml \
|
||||
/var/jenkins_home/ansible/playbooks/matt-capture.yaml --ssh-common-args='-o StrictHostKeyChecking=no' \
|
||||
--extra-vars "saturn_behemoth=${SATURN_BEHEMOTH} "
|
||||
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// Remove dynamic Inventory file
|
||||
sh "rm /var/jenkins_home/ansible/.inv/inventory-${params.host_ip}.yml"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user