# Issue with variable not interpolated using synchronize module

**URL:** <https://forum.ansible.com/t/issue-with-variable-not-interpolated-using-synchronize-module/26484>\
**Category:** Ansible Project\
**Created:** [January 15, 2018, 9:49pm UTC](https://forum.ansible.com/t/issue-with-variable-not-interpolated-using-synchronize-module/26484 "2018-01-15T21:49:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dg1](https://avatars.discourse-cdn.com/v4/letter/d/d07c76/32.png) [@dg1](https://forum.ansible.com/u/dg1)\
**Post date:** [January 15, 2018, 9:49pm UTC](https://forum.ansible.com/t/issue-with-variable-not-interpolated-using-synchronize-module/26484/1 "2018-01-15T21:49:32Z")

</div>

Hello,  
I created a playbook with a simple role to try the synchronize module, but when I run the playbook the hostname variable is not resolved and I get this error:

`ssh: Could not resolve hostname {{ app.vm.hostname }}`

The expected value should be vm.station; I don’t understand the reason, but for example the ssh user is interpolated correctly (see the verbose output at the end of this post). Any help on what to change to make it work would be greatly appreciated.

Python: 3.6.1 / Ansible: 2.4.2.0

**Directory layout:**

`

.  
├── ansible.cfg  
├── hosts  
├── playbook.yml  
├── roles  
│ └── config  
│ └── tasks  
│ └── main.yaml  
└── vars  
└── main.yml  
`

**ansible.cfg:**

`[defaults] inventory = ./hosts roles_path = ./roles`

**hosts:**

`all: hosts: vm: ansible_host: "{{ app.vm.hostname }}" ansible_user: "{{ app.vm.user.username }}" ansible_ssh_pass: "{{ app.vm.user.password }}" ansible_python_interpreter: /usr/bin/python3`

**vars/main.yml:**

`  
app: {  
‘vm’: {  
user: {  
username: “user”,  
password: “user”  
},  
hostname: “vm.station”  
}  
}

`

**playbook.yml:**

`

- hosts: all  
become: true  
vars\_files:
- vars/main.yml  
roles:
- {role: ‘config’, tags: ‘config-all’}  
`

**roles/config/tasks/main.yaml:**

`

- synchronize:  
src: /tmp/foobar.txt  
dest: /tmp  
`

**Command and output:**

`  
$ ansible-playbook playbook.yml -K -vvv

…  
TASK [config : synchronize] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [vm]: FAILED! =\> {  
“changed”: false,  
“cmd”: “/usr/bin/rsync --delay-updates -F --compress --archive --rsh=/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null --rsync-path=sudo rsync --out-format=\<\>%i %n%L /tmp/foobar.txt user@{{ app.vm.hostname }}:/tmp”,  
“invocation”: {  
“module\_args”: {  
“\_local\_rsync\_path”: “rsync”,  
“\_substitute\_controller”: false,  
“archive”: true,  
“checksum”: false,  
“compress”: true,  
“copy\_links”: false,  
“delete”: false,  
“dest”: “user@{{ app.vm.hostname }}:/tmp”, # \<-------- LOOK HERE  
“dest\_port”: null,  
“dirs”: false,  
“existing\_only”: false,  
“group”: null,  
“links”: null,  
“mode”: “push”,  
“owner”: null,  
“partial”: false,  
“perms”: null,  
“private\_key”: null,  
“recursive”: null,  
“rsync\_opts”: null,  
“rsync\_path”: “sudo rsync”,  
“rsync\_timeout”: 0,  
“set\_remote\_user”: true,  
“src”: “/tmp/foobar.txt”,  
“ssh\_args”: null,  
“times”: null,  
“verify\_host”: false  
}  
},  
“msg”: “ssh: Could not resolve hostname {{ app.vm.hostname }}: Name or service not known\r\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: unexplained error (code 255) at io.c(226) [sender=3.1.1]\n”,  
“rc”: 255  
}  
to retry, use: --limit @/tmp/ansible\_webdev/playbook.retry

`
