$ ./run.sh
Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: test.yml *************************************************************
1 plays in test.yml
PLAY [localhost] ***************************************************************
TASK [setup] *******************************************************************
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: algomi-deploy
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950 `" && echo ansible-tmp-1485515755.89-254326766505950="` echo ~/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950 `" ) && sleep 0'
<localhost> PUT /tmp/tmpP7Zu66 TO /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950/setup.py
<localhost> EXEC /bin/sh -c 'chmod u+x /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950/ /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950/setup.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950/setup.py; rm -rf "/opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515755.89-254326766505950/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]
TASK [Slurp the file we wish to search] ****************************************
task path: /opt/home/algomi-deploy/test.yml:4
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/network/basics/slurp.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: algomi-deploy
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445 `" && echo ansible-tmp-1485515756.18-190467128946445="` echo ~/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445 `" ) && sleep 0'
<localhost> PUT /tmp/tmpUjpiaz TO /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445/slurp.py
<localhost> EXEC /bin/sh -c 'chmod u+x /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445/ /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445/slurp.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445/slurp.py; rm -rf "/opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.18-190467128946445/" > /dev/null 2>&1 && sleep 0'
ok: [localhost] => {
"changed": false,
"content": "c3RyaW5nMSBzdHJpbmcyIHN0cmluZzMKc3RyaW5nNCBzdHJpbmc1IHN0cmluZzAKc3RyaW5nNyBzdHJpbmc4IHN0cmluZzkK",
"encoding": "base64",
"invocation": {
"module_args": {
"src": "./example_file.txt"
},
"module_name": "slurp"
},
"source": "./example_file.txt"
}
TASK [To avoid base64 decoding multiple times, we do it once] ******************
task path: /opt/home/algomi-deploy/test.yml:10
ok: [localhost] => {
"ansible_facts": {
"plain_file": "string1 string2 string3\nstring4 string5 string0\nstring7 string8 string9\n"
},
"changed": false,
"invocation": {
"module_args": {
"plain_file": "string1 string2 string3\nstring4 string5 string0\nstring7 string8 string9\n"
},
"module_name": "set_fact"
}
}
TASK [Insert the wanted line into the file as it doesn't exist] ****************
task path: /opt/home/algomi-deploy/test.yml:17
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/files/lineinfile.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: algomi-deploy
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270 `" && echo ansible-tmp-1485515756.42-101048875702270="` echo ~/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270 `" ) && sleep 0'
<localhost> PUT /tmp/tmpPv_qtT TO /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270/lineinfile.py
<localhost> EXEC /bin/sh -c 'chmod u+x /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270/ /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270/lineinfile.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270/lineinfile.py; rm -rf "/opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.42-101048875702270/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=string6) => {
"backup": "",
"changed": true,
"diff": [
{
"after": "",
"after_header": "./example_file.txt (content)",
"before": "",
"before_header": "./example_file.txt (content)"
},
{
"after_header": "./example_file.txt (file attributes)",
"before_header": "./example_file.txt (file attributes)"
}
],
"invocation": {
"module_args": {
"backrefs": false,
"backup": false,
"content": null,
"create": false,
"delimiter": null,
"dest": "./example_file.txt",
"directory_mode": null,
"follow": false,
"force": null,
"group": null,
"insertafter": null,
"insertbefore": null,
"line": "something string6 somethingelse",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "present",
"unsafe_writes": null,
"validate": null
},
"module_name": "lineinfile"
},
"item": "string6",
"msg": "line added"
}
skipping: [localhost] => (item=string1) => {
"changed": false,
"item": "string1",
"skip_reason": "Conditional check failed",
"skipped": true
}
skipping: [localhost] => (item=string8) => {
"changed": false,
"item": "string8",
"skip_reason": "Conditional check failed",
"skipped": true
}
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/files/lineinfile.py
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938 `" && echo ansible-tmp-1485515756.52-54649606538938="` echo ~/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938 `" ) && sleep 0'
<localhost> PUT /tmp/tmpAvxVae TO /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938/lineinfile.py
<localhost> EXEC /bin/sh -c 'chmod u+x /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938/ /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938/lineinfile.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938/lineinfile.py; rm -rf "/opt/home/algomi-deploy/.ansible/tmp/ansible-tmp-1485515756.52-54649606538938/" > /dev/null 2>&1 && sleep 0'
changed: [localhost] => (item=foobar) => {
"backup": "",
"changed": true,
"diff": [
{
"after": "",
"after_header": "./example_file.txt (content)",
"before": "",
"before_header": "./example_file.txt (content)"
},
{
"after_header": "./example_file.txt (file attributes)",
"before_header": "./example_file.txt (file attributes)"
}
],
"invocation": {
"module_args": {
"backrefs": false,
"backup": false,
"content": null,
"create": false,
"delimiter": null,
"dest": "./example_file.txt",
"directory_mode": null,
"follow": false,
"force": null,
"group": null,
"insertafter": null,
"insertbefore": null,
"line": "something foobar somethingelse",
"mode": null,
"owner": null,
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"state": "present",
"unsafe_writes": null,
"validate": null
},
"module_name": "lineinfile"
},
"item": "foobar",
"msg": "line added"
}
PLAY RECAP *********************************************************************
localhost : ok=4 changed=1 unreachable=0 failed=0