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

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.

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”: {}
}

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

https://gist.github.com/vijayakrishnarg1/fc0a037b82cb212708c65ba0b9010631

https://github.com/ansible/community/issues/459