Skip to content

Instantly share code, notes, and snippets.

@agunnerson-ibm agunnerson-ibm/job.log Secret
Last active Sep 16, 2016

Embed
What would you like to do?
Ansible pipeline environment bug
Started by user Andrew Gunnerson
[Pipeline] node
Running on [REDACTED] in /home/jenkins_pm/workspace/PIPELINE_BUG_REPORT
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Ansible Deploy)
[Pipeline] sh
[PIPELINE_BUG_REPORT] Running shell script
[Pipeline] withEnv
[Pipeline] {
[Pipeline] ansiblePlaybook
[PIPELINE_BUG_REPORT] $ ansible-playbook playbook.yml -i inventory -f 5 -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback default of type stdout, v2.0
PLAYBOOK: playbook.yml *********************************************************
1 plays in playbook.yml
PLAY [local] *******************************************************************
TASK [debug] *******************************************************************
task path: /home/jenkins_pm/workspace/PIPELINE_BUG_REPORT/playbook.yml:5
ok: [127.0.0.1] => {
"msg": "Sleeping 30 seconds, check: `tr \\0 \\n /proc/ANSIBLE_PID/environ`"
}
TASK [pause] *******************************************************************
task path: /home/jenkins_pm/workspace/PIPELINE_BUG_REPORT/playbook.yml:7
Pausing for 30 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [127.0.0.1] => {"changed": false, "delta": 30, "invocation": {"module_args": {"seconds": 30}, "module_name": "pause"}, "rc": 0, "start": "2016-09-16 17:09:32.373656", "stderr": "", "stdout": "Paused for 30.0 seconds", "stop": "2016-09-16 17:10:02.373920", "user_input": ""}
PLAY RECAP *********************************************************************
127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
node {
stage('Ansible Deploy') {
sh '''\
#!/bin/bash
cat > playbook.yml << EOF
- hosts: local
connection: local
gather_facts: no
tasks:
- debug:
msg: 'Sleeping 30 seconds, check: \\`tr \\0 \\n /proc/ANSIBLE_PID/environ\\`'
- pause:
seconds: 30
EOF
cat > inventory << EOF
[local]
127.0.0.1
EOF
touch test.cfg
'''.stripIndent()
// Neither this nor the withEnv() works
env.ANSIBLE_CONFIG = "test.cfg"
withEnv(['ANSIBLE_CONFIG=test.cfg']) {
ansiblePlaybook(
ansibleName: 'ansible-virt-env_2.1.0.0',
playbook: 'playbook.yml',
inventory: "inventory",
extras: "-vvvv"
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.