Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize module not recognizing remote ssh key #24

Closed
ewelchman opened this issue May 15, 2020 · 1 comment
Closed

Synchronize module not recognizing remote ssh key #24

ewelchman opened this issue May 15, 2020 · 1 comment
Labels
bug This issue/PR relates to a bug.

Comments

@ewelchman
Copy link

SUMMARY

I am attempting to synchronize in push mode a couple of directories from one remote host (A) to a second remote host (B). The rsync command shown in ansible's output works as expected when run on remote host A.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Synchronize module

ANSIBLE VERSION
ansible 2.9.9
  config file = /home/evan/repos/infrastructure_ansible/ansible.cfg
  configured module search path = [u'/home/evan/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]

CONFIGURATION

OS / ENVIRONMENT

Ansible host: Ubuntu 18.04
Remote hosts: Ubuntu 18.04

STEPS TO REPRODUCE
- synchronize:  # push from alpha to others
    mode: push
    src: "/home/{{ ansible_user }}/robot_code/cloud_sync_siam"
    dest: "/home/{{ ansible_user }}/robot_code"
    recursive: 'yes'
    delete: 'yes'
    rsync_opts: --rsh="/usr/bin/ssh -o PasswordAuthentication=no -i /home/{{ ansible_user }}/.ssh/team_van_rsa"
  become: "{{ ansible_user }}"
  delegate_to: "{{ inventory_host }}"
EXPECTED RESULTS

A successful rsync from the delegated remote host to remote host B

ACTUAL RESULTS

It appears that the ssh key to be used for connecting from remote host A to remote host B cannot be found. However, the given rsync command runs as expected when run as {{ ansible_user }} on the delegated host (after including quotes around the --out-format).

TASK [abii-updater : synchronize] *******************************************************************************************
fatal: [thruway-dev-bravo -> 13.68.168.84]: FAILED! => changed=false 
  cmd: /usr/bin/rsync --delay-updates -F --compress --delete-after --archive --rsh="/usr/bin/ssh -o PasswordAuthentication=no -i /home/azureuser/.ssh/team_van_rsa" --out-format=<<CHANGED>>%i %n%L /home/azureuser/robot_code/cloud_sync_siam azureuser@20.185.12.157:/home/azureuser/robot_code
  invocation:
    module_args:
      _local_rsync_password: null
      _local_rsync_path: rsync
      _substitute_controller: false
      archive: true
      checksum: false
      compress: true
      copy_links: false
      delete: true
      dest: azureuser@20.185.12.157:/home/azureuser/robot_code
      dest_port: 22
      dirs: false
      existing_only: false
      group: null
      link_dest: null
      links: null
      mode: push
      owner: null
      partial: false
      perms: null
      private_key: /home/evan/.ssh/team_van_rsa
      recursive: true
      rsync_opts:
      - --rsh="/usr/bin/ssh -o PasswordAuthentication=no -i /home/azureuser/.ssh/team_van_rsa"
      rsync_path: null
      rsync_timeout: 0
      set_remote_user: true
      src: /home/azureuser/robot_code/cloud_sync_siam
      ssh_args: null
      times: null
      verify_host: false
  msg: |-
    rsync: Failed to exec /usr/bin/ssh -o PasswordAuthentication=no -i /home/azureuser/.ssh/team_van_rsa: No such file or directory (2)
    rsync error: error in IPC code (code 14) at pipe.c(85) [sender=3.1.2]
    rsync: connection unexpectedly closed (0 bytes received so far) [sender]
    rsync error: error in IPC code (code 14) at io.c(235) [sender=3.1.2]
  rc: 14
@maxamillion maxamillion added the bug This issue/PR relates to a bug. label Sep 28, 2020
@intiocean
Copy link

I believe this is a continuation of this old issue: ansible/ansible#46126 that still haunts me and means I have to run a synchronize step manually every now and again 😭

@ansible-zuul ansible-zuul bot closed this as completed in 0118bf0 Jul 14, 2021
ansible-zuul bot added a commit that referenced this issue Jul 14, 2021
synchronize: quotes around arguments

fix quoting for specific cmd arguments
Fixes:

#24
#190

ISSUE TYPE:

Bugfix Pull Request

COMPONENT NAME:
module: synchronize

Reviewed-by: Abhijeet Kasurde <None>
Reviewed-by: Robert Rettig <None>
Reviewed-by: Hideki Saito <saito@fgrep.org>
Reviewed-by: Mike Graves <mgraves@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants