How to pass "stdout" of a variable "command_result" belonging to Ansible
Play-1 to shell module of a different Play-2?
My playbook looks like below:
- name: Play 1
hosts: localhost
tasks:
- name: "Collect Output"
command: ls -ltr *
register: command_result
- name: Play 2
hosts: remotehost
tasks:
- shell: "~/rollback.sh {{ Number }} '{{ InstallDir }}' '{{
hostvars[\"localhost\"][\"command_result\"].results|map(attribute=/'stdout/')|list
}}' > ~/rollback.log"
I get runtime error executing shell which is of the nature below:
fatal: [10.12.34.43]: FAILED! => {"msg": "template error while templating
> string: unexpected '/'. String: ~/rollback.sh {{ Number }} '{{ InstallDir
> }}' '{{
> hostvars[\"localhost\"][\"command_result\"].results|map(attribute=/'stdout/')|list
>
> }}' > ~/rollback.log"}
I tried several tweaks but not sure how to get this to work ?
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/32cad80c-20e9-49b0-a8b2-c5ac6e9dedbb%40googlegroups.com.