On Fri, 30 Aug 2019 01:22:08 -0700 (PDT) Mohtashim S <[email protected]> wrote:
> - 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"}
The problem is the string is shell. Try to create the parameters first. For
example
- set_fact:
my_list: "{{ hostvars['localhost'].command_result.results|
map(attribute='stdout')|list }}"
- shell: "~/rollback.sh {{ Number }} '{{ InstallDir }}' '{{ my_list }}' >
~/rollback.log"
--
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/20190830110857.6f7fa8a8%40gmail.com.
pgpCbSLNR8Cm6.pgp
Description: OpenPGP digital signature
