Synchronize command not working when upgraded to Ansible 2.1.0

171 views
Skip to first unread message

Michael Lennon

unread,
Jul 5, 2016, 5:45:26 PM7/5/16
to Ansible Project
Hi,
    We were recently upgraded to Ansible 2.1.0, from 1.9.4 (I think). Now have an issue with any playbooks that make use of the synchronize module. I have a a test playbook that simply copies a text file from Host A to Host B and the job is delegated to Host C.


cat test_connectivity.yml
- name: Copy the text file from /home/triarch/ansible_test.txt to target host to check ansible connectivity
  hosts: '{{ target }}'
  remote_user: triarch
  gather_facts: no
  
  tasks:
   - name: copy over the test text file to /home/triarch
     synchronize: mode=push src=/tmp/ansible_test.txt dest=/home/triarch 
     delegate_to: HostC

Output from running the playbook is;

[root@HostB]# ansible-playbook test_connectivity.yml --extra-vars "target=HostB" -vvv
Using /etc/ansible/ansible.cfg as config file
1 plays in test_connectivity.yml

PLAY [Copy the text file from /home/triarch/ansible_test.txt to target host to check ansible connectivity] ***

TASK [copy over the test text file to /hostname/triarch] ***********************
task path: /mnt/ansible/playbooks/mdi/test/test_connectivity.yml:7
<HostC> ESTABLISH SSH CONNECTION FOR USER: triarch
<HostC> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=triarch -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt HostC'/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1467723381.55-23670874385865 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1467723381.55-23670874385865 `" )'"'"''
<HostC> PUT /tmp/tmpL7jmA3 TO /home/triarch/.ansible/tmp/ansible-tmp-1467723381.55-23670874385865/synchronize
<HostC> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=triarch -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r '[HostC]'
<HostC> ESTABLISH SSH CONNECTION FOR USER: triarch
<HostC> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=triarch -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt HostC'/bin/sh -c '"'"'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/triarch/.ansible/tmp/ansible-tmp-1467723381.55-23670874385865/synchronize; rm -rf "/home/triarch/.ansible/tmp/ansible-tmp-1467723381.55-23670874385865/" > /dev/null 2>&1'"'"''
fatal: [HostB-> HostC]: FAILED! => {"changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh '/etc/ssh  -S none -o StrictHostKeyChecking=no -o Port=22' --out-format='<<CHANGED>>%i %n%L' \"/tmp/ansible_test.txt\" \"HostB:/home/triarch\"", "failed": true, "invocation": {"module_args": {"_local_rsync_path": "rsync", "_substitute_controller": false, "archive": true, "checksum": false, "compress": true, "copy_links": null, "delete": false, "dest": "HostB:/home/triarch", "dest_port": "22", "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": null, "rsync_timeout": 0, "set_remote_user": true, "src": "/tmp/ansible_test.txt", "ssh_args": null, "times": null, "verify_host": false}}, "msg": "rsync: Failed to exec /etc/ssh: Permission denied (13)\nrsync error: error in IPC code (code 14) at pipe.c(84) [sender=3.0.4]\nrsync: connection unexpectedly closed (0 bytes received so far) [sender]\nrsync error: error in IPC code (code 14) at io.c(632) [sender=3.0.4]\n", "rc": 14}

NO MORE HOSTS LEFT *************************************************************
        to retry, use: --limit @test_connectivity.retry

PLAY RECAP *********************************************************************
HostB                : ok=0    changed=0    unreachable=0    failed=1   


Any ideas?

Thanks,

Mick

Joanna Delaporte

unread,
Jul 6, 2016, 11:35:33 AM7/6/16
to Ansible Project
Hi Mick, 

The docs say that using push mode, the delegate is the source of the sync. So, your task is trying to ssh from HostC (the delegate) to HostB. Can these two hosts talk to each other? Maybe you meant to delegate_to: HostA?

Joanna

Dick Davies

unread,
Jul 7, 2016, 1:41:17 PM7/7/16
to ansible list
Something is screwy :

"Failed to exec /etc/ssh: Permission denied"


> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4556fbbb-1c78-47fb-9ddb-4dcec486d7c1%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages