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 ignores ansible_ssh* when delegate_to is used #553

Open
skwde opened this issue Jun 26, 2024 · 0 comments
Open

synchronize ignores ansible_ssh* when delegate_to is used #553

skwde opened this issue Jun 26, 2024 · 0 comments
Labels
synchronize Issue and PR for synchronize module

Comments

@skwde
Copy link

skwde commented Jun 26, 2024

SUMMARY

When delegate_to is used, the ansible_ssh* variables from the inventory are ignored even when use_ssh_args: true.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.posix.synchronize

ANSIBLE VERSION
ansible [core 2.16.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/mambaforge/envs/ansible/lib/python3.12/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/mambaforge/envs/ansible/bin/ansible
  python version = 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 08:03:24) [GCC 12.3.0] (/opt/mambaforge/envs/ansible/bin/python3.12)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
Collection    Version
------------- -------
ansible.posix 1.5.4  
community.general 8.3.0 
CONFIGURATION
COLLECTIONS_PATHS(/etc/ansible/ansible.cfg) = ['~/.ansible/collections', '/usr/share/ansible/collections']
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_FILTER_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['~/.ansible/plugins/filter', '/usr/share/ansible/plugins/filter']
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['~/.ansible/roles', '/usr/share/ansible/roles', '/etc/ansible/roles']
EDITOR(env: EDITOR) = vim
GALAXY_COLLECTION_SKELETON_IGNORE(/etc/ansible/ansible.cfg) = ['^.git$', '^.*/.git_keep$', '^.*/.gitkeep$']
OS / ENVIRONMENT

CentOS7, Rocky8, Rocky9

STEPS TO REPRODUCE

The hosts.yml

all:
  hosts:
    jump:
    dest:
    src:
      ansible_ssh_common_args: "-J jump.host"

and the playbook

- name: Test stuff
  gather_facts: false
  hosts: src

  tasks:
    - name: Sync file to dest
      ansible.posix.synchronize:
        mode: pull
        src: /tmp/file
        dest: /tmp/file
        use_ssh_args: true
      delegate_to: dest
      become: true
EXPECTED RESULTS

The resulting rsync command should include -J jump.host in the --rsh option.

ACTUAL RESULTS

The ansible_ssh* variables set in hosts.yml are ignored.
Consequently the play fails.

fatal: [src -> dest]: FAILED! => changed=false 
  cmd: /bin/rsync --delay-updates -F --compress --archive --rsh='/bin/ssh -S none -i /root/.ssh/id_rsa -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no' --rsync-path='sudo -u root rsync' --out-format='<<CHANGED>>%i %n%L' root@dest:/tmp/file /tmp/file
  msg: |-
    sss_ssh_knownhostsproxy: Could not resolve hostname src
    kex_exchange_identification: Connection closed by remote host
    Connection closed by UNKNOWN port 65535
    rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
    rsync error: unexplained error (code 255) at io.c(228) [Receiver=3.2.3]
  rc: 255

Possibly related:

@saito-hideki saito-hideki added the synchronize Issue and PR for synchronize module label Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
synchronize Issue and PR for synchronize module
Projects
None yet
Development

No branches or pull requests

2 participants