Your example seems to work with command instead of raw:
$ ansible-playbook --version
ansible-playbook 1.9.1
configured module search path = None
$ ansible-playbook /var/tmp/equal.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [run docker command] ****************************************************
changed: [localhost]
TASK: [debug var=output['stdout_lines']] **************************************
ok: [localhost] => {
"var": {
"output['stdout_lines']": [
"['/var/tmp/test.py', 'run', '-e', 'SOMEVAR=122', '-e',
'bla=123', '-e', 'another=1233', 'registry:2.0']"
]
}
}
PLAY RECAP ********************************************************************
localhost : ok=3 changed=1 unreachable=0 failed=0
$ cat /var/tmp/equal.yml
---
- hosts: localhost
vars:
- container_commands:
ops_registry_1: -e SOMEVAR='122' -e bla='123' -e another='1233'
- container_name: ops_registry_1
tasks:
- name: run docker command
command: "/var/tmp/test.py run {{
container_commands[container_name] }} registry:2.0"
register: output
- debug: var=output['stdout_lines']
(test.py is just a short script that's echoing the value of argv).
The handling of equals is something that we're constantly trying to
strike the right balance between security and usability so if you
aren't running 1.9.x, please try upgrading to see if that helps.
On Thu, May 28, 2015 at 8:26 AM, Patrick Debois
<[email protected]> wrote:
>> Have you tried command or shell?
>
>
> Yes I did, I guess it's a general security safeguard . But how to
> express/escape it correctly.
> I now work around through generating a script file through a template and
> executing that.
> But I guess there must be a more elegant way?
>
> --
> 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/3925296c-9710-467c-8a81-5f29531f1995%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
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/CAG9juEowGK2Ne8UaX8aKuyagS7DUKYH3t-P5QacKDAL_H-yU6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.