Am 29.03.16 schrieb Johannes Kastl:

>> I opened issue 15191:
>> https://github.com/ansible/ansible/issues/15191
> 
> ...and I closed the issue, as I found the problem:
> 
> The quoted string has to be quoted again, otherwise the controller's
> shell will eat the quotes and the "env ASSUME..." part...

Once again I eat my words. Seems to become a habit...

The twice-quoted command runs and returns a success message, but
apparently does nothing.

Using the following playbook works:

> - hosts: all
>   gather_facts: false
>   become_method: sudo
>   become: yes
>   tasks:
>     - name: Bootstrapping pkg
>       raw: /usr/sbin/pkg -N
>       register: pkg
>       ignore_errors: True
> 
>     - raw: /usr/bin/env ASSUME_ALWAYS_YES=1 /usr/sbin/pkg bootstrap -f
>       when: pkg|failed
> 
>     - name: install python
>       raw: /usr/sbin/pkg install -y python27

So it seems to be some kind of quoting hell. How to quote the argument
for the raw module in a way that everything works?

> ansible -m raw -a 'env ASSUME_ALWAYS_YES=YES pkg bootstrap -f' foobar
hangs waiting for the confirmation

> ansible -m raw -a "env ASSUME_ALWAYS_YES=YES pkg bootstrap -f" foobar
hangs waiting for the confirmation

> ansible -m raw -a '"env ASSUME_ALWAYS_YES=YES pkg bootstrap -f"' foobar
returns with success, but does nothing

> ansible -m raw -a "'env ASSUME_ALWAYS_YES=YES pkg bootstrap -f'" foobar
returns with success, but does nothing

> ansible -m raw -a "\"env ASSUME_ALWAYS_YES=YES pkg bootstrap -f\"" foobar
returns with success, but does nothing

Regards,
Johannes


-- 
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/56FACE2F.3000006%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to