# Ansible having an issue when we pass dictionary as extra variable on centos machine

**URL:** <https://forum.ansible.com/t/ansible-having-an-issue-when-we-pass-dictionary-as-extra-variable-on-centos-machine/30086>\
**Category:** Ansible Developer\
**Created:** [April 9, 2019, 8:34pm UTC](https://forum.ansible.com/t/ansible-having-an-issue-when-we-pass-dictionary-as-extra-variable-on-centos-machine/30086 "2019-04-09T20:34:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krishna\_G](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Krishna\_G](https://forum.ansible.com/u/Krishna_G)\
**Post date:** [April 9, 2019, 8:34pm UTC](https://forum.ansible.com/t/ansible-having-an-issue-when-we-pass-dictionary-as-extra-variable-on-centos-machine/30086/1 "2019-04-09T20:34:10Z")

</div>

**Local Machine:**

Ansible version: 2.4.1.0python version = 2.7.10

**Remote Redhat Machine:**

Ansible version: 2.7.7  
Python: 2.7.5

i have ansible running on my local machine(MAC), when i pass extra varibale as map it’s reading all the values in the map and giving proper results.

If i run same task on remote machine which redhat vm, it’s always reading last value in the map, please look at the issue and suggest me, is it Playbook issue or ansible version issue?

Here is the Playbook:

**ansible-playbook values\_files.yml -i localhost --extra-vars “@values\_files\_variable.yml” ‘–extra-vars={“MICROSERVICE\_NAMES”:[“processor-create”,“processor-update”]}’ ‘–extra-vars={“MICROSERVICE\_ENV\_MAP”:{}}’**

if i execute above playbook on my local machine it’s reading both the values in the **MICROSERVICE\_NAMES map :** processor-create and processor-update

same playbook execute on Redhat remote machine, it’s reading only what ever defined at the end in the map (processor-update), please suggest me , Thanks.

---

<div class="post-metadata">

**Author:** ![Andrew\_Gaffney](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@Andrew\_Gaffney](https://forum.ansible.com/u/Andrew_Gaffney)\
**Post date:** [April 9, 2019, 9:03pm UTC](https://forum.ansible.com/t/ansible-having-an-issue-when-we-pass-dictionary-as-extra-variable-on-centos-machine/30086/2 "2019-04-09T21:03:10Z")

</div>

When I tried to reproduce on both my Ubuntu 16.04 machine and in CentOS 7 (via Docker) with Ansible 2.7.10, I got the expected results. It would help if you could put together a gist/pastebin showing the command you’re running and the output showing that one of the vars is not being recognized. It would also be faster/easier if you came by the #ansible IRC channel rather than using the mailing list for this sort of debugging.

[root@0d33208d666a /]# ansible localhost ‘–extra-vars={“MICROSERVICE\_NAMES”:[“processor-create”,“processor-update”]}’ ‘–extra-vars={“MICROSERVICE\_ENV\_MAP”:{}}’ -m debug -a var=MICROSERVICE\_NAMES  
localhost | SUCCESS =\> {

“MICROSERVICE\_NAMES”: [  
“processor-create”,  
“processor-update”  
]  
}  
[root@0d33208d666a /]# ansible localhost ‘–extra-vars={“MICROSERVICE\_NAMES”:[“processor-create”,“processor-update”]}’ ‘–extra-vars={“MICROSERVICE\_ENV\_MAP”:{}}’ -m debug -a var=MICROSERVICE\_ENV\_MAP  
localhost | SUCCESS =\> {  
“MICROSERVICE\_ENV\_MAP”: {}  
}

---

<div class="post-metadata">

**Author:** ![Krishna\_G](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Krishna\_G](https://forum.ansible.com/u/Krishna_G)\
**Post date:** [April 9, 2019, 9:59pm UTC](https://forum.ansible.com/t/ansible-having-an-issue-when-we-pass-dictionary-as-extra-variable-on-centos-machine/30086/3 "2019-04-09T21:59:41Z")

</div>

Here is the Gist created running same playbook on Mac and Centos machines.

[https://gist.github.com/vijayakrishnarg1/fc0a037b82cb212708c65ba0b9010631](https://gist.github.com/vijayakrishnarg1/fc0a037b82cb212708c65ba0b9010631)

---

<div class="post-metadata">

**Author:** ![Krishna\_G](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Krishna\_G](https://forum.ansible.com/u/Krishna_G)\
**Post date:** [April 9, 2019, 10:03pm UTC](https://forum.ansible.com/t/ansible-having-an-issue-when-we-pass-dictionary-as-extra-variable-on-centos-machine/30086/4 "2019-04-09T22:03:00Z")

</div>

[https://github.com/ansible/community/issues/459](https://github.com/ansible/community/issues/459)
