test jenkinsfile update for windows 1.2
This commit is contained in:
@ -33,8 +33,8 @@ pipeline {
|
||||
jenkins_subnet_group=\$(echo ${env.BUILD_USER_GROUPS} | sed 's/,/\\n/g' | grep -e authenticated -e \$SERVER_SUBNET_GROUP | sort -rf | head -n 1)
|
||||
jenkins_user=\$(echo ${env.BUILD_USER})
|
||||
cd /var/jenkins_home/ansible
|
||||
chmod +x /var/jenkins_home/ansible/inventory/inventory.sh
|
||||
/var/jenkins_home/ansible/inventory/inventory.sh -v -s -a \$jenkins_subnet_group -g \$jenkins_group -u \$jenkins_user \
|
||||
chmod +x /var/jenkins_home/ansible-windows/inventory/inventory.sh
|
||||
/var/jenkins_home/ansible-windows/inventory/inventory.sh -v -s -a \$jenkins_subnet_group -g \$jenkins_group -u \$jenkins_user \
|
||||
-w ${env.ansible_service_windows_USR} -p ${env.ansible_service_windows_PSW} -i ${params.host_ip}
|
||||
|
||||
"""
|
||||
@ -44,13 +44,16 @@ pipeline {
|
||||
stage('Ansible Playbook') {
|
||||
steps {
|
||||
sh """
|
||||
echo Generate Hash
|
||||
echo ${params.host_ip}
|
||||
hash=\$(echo -n ${params.host_ip} | md5sum | cut -c 1-8)
|
||||
|
||||
inventory_file="/var/jenkins_home/ansible-windows/.inv/inventory-\$hash.yml"
|
||||
playbook_file="/var/jenkins_home/ansible-windows/playbooks/test.yaml"
|
||||
|
||||
cd /var/jenkins_home/ansible-windows
|
||||
|
||||
echo ansible-playbook -i \$inventory_file /var/jenkins_home/ansible-windows/playbooks/test.yaml \
|
||||
echo ansible-playbook -i \$inventory_file \$playbook_file \
|
||||
--ssh-common-args='-o StrictHostKeyChecking=no' "
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user