# How to pass list of arguments that contains "=" signs to raw command  ?

**URL:** <https://forum.ansible.com/t/how-to-pass-list-of-arguments-that-contains-signs-to-raw-command/18318>\
**Category:** Ansible Project\
**Created:** [May 27, 2015, 3:47pm UTC](https://forum.ansible.com/t/how-to-pass-list-of-arguments-that-contains-signs-to-raw-command/18318 "2015-05-27T15:47:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Debois](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Patrick\_Debois](https://forum.ansible.com/u/Patrick_Debois)\
**Post date:** [May 27, 2015, 3:47pm UTC](https://forum.ansible.com/t/how-to-pass-list-of-arguments-that-contains-signs-to-raw-command/18318/1 "2015-05-27T15:47:39Z")

</div>

I’m trying to find an easy way to specify args to a command.  
The args contain ‘=’ signs triggering the error

`A variable inserted a new parameter into the module args. Be sure to quote variables if they contain equal signs (for example: "{{var}}").`

Can you help me find the magic syntax?

```auto
- hosts: somehost
  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
       raw: "docker run {{ container_commands[container_name] }} registry:2.0"

```

`

I’ve considered:

- putting all the args in a environment hash and join them, but I guess it’s the same issue.
- using with\_items but this gave the same issue
- using single , double etc… quotes

thanks for your assistance  
`

---

<div class="post-metadata">

**Author:** ![Paul\_Totterman](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@Paul\_Totterman](https://forum.ansible.com/u/Paul_Totterman)\
**Post date:** [May 28, 2015, 7:54am UTC](https://forum.ansible.com/t/how-to-pass-list-of-arguments-that-contains-signs-to-raw-command/18318/2 "2015-05-28T07:54:59Z")

</div>

> `raw: "docker run {{ container_commands[container_name] }} registry:2.0"`

raw:

Executes a low-down and dirty SSH command, not going through the module subsystem. This is useful and should only be done in two cases. The first case is installing `python-simplejson` on older (Python 2.4 and before) hosts that need it as a dependency to run modules, since nearly all core modules require it. Another is speaking to any devices such as routers that do not have any Python installed. In any other case, using the [shell](http://docs.ansible.com/shell_module.html#shell) or [command](http://docs.ansible.com/command_module.html#command) module is much more appropriate.

Have you tried command or shell?

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![Patrick\_Debois](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@Patrick\_Debois](https://forum.ansible.com/u/Patrick_Debois)\
**Post date:** [May 28, 2015, 3:26pm UTC](https://forum.ansible.com/t/how-to-pass-list-of-arguments-that-contains-signs-to-raw-command/18318/3 "2015-05-28T15:26:27Z")

</div>

> 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?

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [May 28, 2015, 3:52pm UTC](https://forum.ansible.com/t/how-to-pass-list-of-arguments-that-contains-signs-to-raw-command/18318/4 "2015-05-28T15:52:58Z")

</div>

Your example seems to work with command instead of raw:

$ ansible-playbook --version  
ansible-playbook 1.9.1  
&nbsp;&nbsp;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] =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"var": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"output['stdout\_lines']": [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"['/var/tmp/test.py', 'run', '-e', 'SOMEVAR=122', '-e',  
'bla=123', '-e', 'another=1233', 'registry:2.0']"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]  
&nbsp;&nbsp;&nbsp;&nbsp;}  
}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
localhost : ok=3 changed=1 unreachable=0 failed=0

$ cat /var/tmp/equal.yml
