Hello everyone,
It seems quite difficult to perform a very simple task: save the content of
a variable to a file.
This variable content is not just a string, but several lines as shown by
the debug module:
"out.stdout_lines": [
[
"Using 2011 out of 262144 bytes, uncompressed size = 3870
bytes",
"!",
"! Last configuration change at 18:34:42 UTC Thu Jun 30 2016 by
admin",
"!",
"version 15.2",
...
"hostname IOSv_L2_1",
...
"end",
""
]
]
Trying to use the "copy" module leads to the previously mentioned issue:
- name: Copying config into local file
copy:
content: "{{ out.stdout_lines }}"
dest: host_vars/{{ inventory_hostname }}/{{ inventory_hostname
}}_{{ config }}.txt
=>
TASK [ios_pull_config : Copying config into local file]
************************
task path:
/home/actionmystique/Program-Files/Ubuntu/Ansible/git-Ansible/roles/ios_pull_config/tasks/main.yml:59
<192.168.137.242> ESTABLISH LOCAL CONNECTION FOR USER: root
<192.168.137.242> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
$HOME/.ansible/tmp/ansible-tmp-1467812828.82-260068933148720 `" && echo
ansible-tmp-1467812828.82-260068933148720="` echo
$HOME/.ansible/tmp/ansible-tmp-1467812828.82-260068933148720 `" ) && sleep
0'
<192.168.137.242> PUT /tmp/tmpotKrzg TO
/root/.ansible/tmp/ansible-tmp-1467812828.82-260068933148720/stat
<192.168.137.242> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8 /usr/bin/python
/root/.ansible/tmp/ansible-tmp-1467812828.82-260068933148720/stat; rm -rf
"/root/.ansible/tmp/ansible-tmp-1467812828.82-260068933148720/" > /dev/null
2>&1 && sleep 0'
<192.168.137.242> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
$HOME/.ansible/tmp/ansible-tmp-1467812828.91-263479362702141 `" && echo
ansible-tmp-1467812828.91-263479362702141="` echo
$HOME/.ansible/tmp/ansible-tmp-1467812828.91-263479362702141 `" ) && sleep
0'
<192.168.137.242> PUT /tmp/tmp5gr0LH TO
/root/.ansible/tmp/ansible-tmp-1467812828.91-263479362702141/source
fatal: [192.168.137.242]: FAILED! => {"failed": true, "msg": "*module
(copy) is missing interpreter line*"}
In /etc/ansible/ansible.cfg with ansible 2.1.1.0, the default library path
is defined:
library = /usr/lib/python2.7/dist-packages/ansible
Also, there are 2 default "copy.py" in the downstream tree:
- ./modules/core/files/copy.py
- ./plugins/action/copy.py
Isn't this confusing for Ansible?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7ff7b3cf-63f6-4693-967b-e293a2c99872%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.