Ansible Docker module not picking up variables

I am a newbie with ansible, I am trying to spin up a docker container with the following command

`

  • name: Swarm node is running
    docker:
    docker_api_version: 1.18
    name: swarm-node
    image: swarm
    command: join --addr={{ ip }}:2375 token://{{ swarm_cluster_token }}
    state: restarted
    when: not swarm_master is defined
    register: docker_cmd
    tags: [swarm]
    `

I see that the variables are not expand for {{ ip }} and {{ swarm_cluster_token }}, when i tried debug the variables i see they are available inside the playbook.

I tried doing the following options:

'join --addr="{{ ip }}":2375 token://"{{ swarm_cluster_token }}"'

I am using the ansible 1.9.2 , docker v1.7.1, docker-py: 1.3.1 but pinned the version of the docker api to 1.18 to circumvent the issue posted https://github.com/ansible/ansible-modules-core/issues/1707

Still with the same result, any thoughts why the variables are not getting expanded inside the docker command ?

Cheers,
Kamesh

Sorry for this issue, after debugging i understood for docker-swarm the ip is just used for addressing and its not listed with docker ps , when I inspected the node I see the IP getting passed correctly.