ansible-collections / ansible.posix

Ansible Collection for Posix
Other
155 stars 149 forks source link

Synchronize module throws '[Errno 2] No such file or directory' when using password authentication #89

Open lucas-benedito opened 4 years ago

lucas-benedito commented 4 years ago
SUMMARY

In Ansible 2.9.11 running on rhel 8, synchronize module fails to transfer with '[Errno 2] No such file or directory' in similar fashion as in #56629. All suggestions from the previous issue were followed and i was unable to solve it. The only way to avoid the issue is to use ssh-key based connection as it doesn't use sshpass.

ISSUE TYPE
COMPONENT NAME

synchronize

ANSIBLE VERSION
ansible 2.9.11
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
OS / ENVIRONMENT

Red Hat Enterprise Linux release 8.2 (Ootpa)

STEPS TO REPRODUCE

freshly installed RHEL 8 environment without any customization. mkdir /tmp/testdir ; echo 'Ansible Managed' >> /tmp/testdir/file-transfer

---
- name: Sync between servers
  hosts: all
  tasks:
  - name: Transfering from between servers using delegate
    synchronize:
      src: /tmp/testdir
      dest: /tmp
    delegate_to: source_server
EXPECTED RESULTS
$ ansible-playbook sync.yml -i inventory
PLAY [Sync between servers] ******************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [ec2-3-249-227-122.eu-west-1.compute.amazonaws.com]

TASK [Transfering from between servers using delegate] ***************************************************************************************************************************************************************************************
changed: [ec2-3-249-227-122.eu-west-1.compute.amazonaws.com -> ec2-3-249-85-67.eu-west-1.compute.amazonaws.com]

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
ec2-3-249-227-122.eu-west-1.compute.amazonaws.com : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
$
ACTUAL RESULTS
$ ansible-playbook sync.yml -i inventory -u ansible -k -vvv
ansible-playbook 2.9.11
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.6/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 3.6.8 (default, Dec  5 2019, 15:45:45) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
SSH password: 
host_list declined parsing /home/ansible/inventory as it did not pass its verify_file() method
script declined parsing /home/ansible/inventory as it did not pass its verify_file() method
auto declined parsing /home/ansible/inventory as it did not pass its verify_file() method
Parsed /home/ansible/inventory inventory source with ini plugin

PLAYBOOK: sync.yml ***************************************************************************************************************************************************************************************************************************
1 plays in sync.yml

PLAY [Sync between servers] ******************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
task path: /home/ansible/sync.yml:2
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'/home/ansible\n', b'')
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151 && echo ansible-tmp-1598346765.0777154-5325-64035331839151="` echo /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151 `" ) && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'ansible-tmp-1598346765.0777154-5325-64035331839151=/home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151\n', b'')
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> Attempting python interpreter discovery
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'PLATFORM\nLinux\nFOUND\n/usr/libexec/platform-python\nENDFOUND\n', b'')
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'/usr/libexec/platform-python && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'{"platform_dist_result": ["redhat", "8.2", "Ootpa"], "osrelease_content": "NAME=\\"Red Hat Enterprise Linux\\"\\nVERSION=\\"8.2 (Ootpa)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVERSION_ID=\\"8.2\\"\\nPLATFORM_ID=\\"platform:el8\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux 8.2 (Ootpa)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:8.2:GA\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 8\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=8.2\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"8.2\\"\\n"}\n', b'')
Using module file /usr/lib/python3.6/site-packages/ansible/modules/system/setup.py
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> PUT /home/ansible/.ansible/tmp/ansible-local-5318rvb_n_o4/tmpqn949450 TO /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151/AnsiballZ_setup.py
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e '[ec2-3-249-227-122.eu-west-1.compute.amazonaws.com]'
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'sftp> put /home/ansible/.ansible/tmp/ansible-local-5318rvb_n_o4/tmpqn949450 /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151/AnsiballZ_setup.py\n', b'')
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151/ /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151/AnsiballZ_setup.py && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'', b'')
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e -tt ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'/usr/libexec/platform-python /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151/AnsiballZ_setup.py && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'\r\n{"ansible_facts": {"ansible_user_id": "ansible", "ansible_user_uid": 1001, "ansible_user_gid": 1001, "ansible_user_gecos": "", "ansible_user_dir": "/home/ansible", "ansible_user_shell": "/bin/bash", "ansible_real_user_id": 1001, "ansible_effective_user_id": 1001, "ansible_real_group_id": 1001, "ansible_effective_group_id": 1001, "ansible_dns": {"search": ["eu-west-1.compute.internal"], "nameservers": ["172.31.0.2"]}, "ansible_system": "Linux", "ansible_kernel": "4.18.0-193.el8.x86_64", "ansible_kernel_version": "#1 SMP Fri Mar 27 14:35:58 UTC 2020", "ansible_machine": "x86_64", "ansible_python_version": "3.6.8", "ansible_fqdn": "ip-172-31-23-42.eu-west-1.compute.internal", "ansible_hostname": "ip-172-31-23-42", "ansible_nodename": "ip-172-31-23-42.eu-west-1.compute.internal", "ansible_domain": "eu-west-1.compute.internal", "ansible_userspace_bits": "64", "ansible_architecture": "x86_64", "ansible_userspace_architecture": "x86_64", "ansible_machine_id": "c91021a7ea684c2681af7bd9d965c2c5", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABgQCcV4gj3QVLcr2SICCZJZoSqZjhKRO6XOP1AeJO3SeD0Iunxx/8OKcT4gDOpGoiar6wbsO6XQNMddV4rt1ewjj+IjaKgRGYb0UeGrDQi9ZIE3IAdfvZGUDNST0KiEry/CJ9P+BVNeYk0V9VNS9ffK08AkYuqR7l5Mn6BmwIugQXJWPMU9cJpAajobCagaUKy2NX7I13FPKO1vAGW8Oy+EarHAAKjRlZB3t3pVNB1NdDBqrVdeqfB6wFjGKG+whgsNv/WG8omyJp90vWZcnU+jZECphnCG25H1HII1mFh5h99NjYhI3lwv8C2ioV7LV2XfGoqJlHGA8LSNC26eHn95HkuYZyNjIUNavll2u2JdYTX3FxRkSb3y0eCXKe3Mf5VmP6r9JianL+4eiJI/EDv5IrMlnDYlLq9UkqI0S73TieSfRov0PtZa7AzxM5QcLZk36gs4alulArL8M2NSsHP6uUt4slp3Mb4tRMDfNSUoDczcRIRO7VahvIUMGunObLwIc=", "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDGaQSACO6m7SJdy9C94gq7FvYNVSQwR/dWkEK/6tKMgyUhCofUsNxnlkUbdqRj88jr16JAhx4VtGK6ZlUmJlys=", "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIOcxTNb++LMEkJqYpZyOa7+d2bME1Dg/aR1q2sNn32cr", "ansible_lsb": {}, "ansible_distribution": "RedHat", "ansible_distribution_release": "Ootpa", "ansible_distribution_version": "8.2", "ansible_distribution_major_version": "8", "ansible_distribution_file_path": "/etc/redhat-release", "ansible_distribution_file_variety": "RedHat", "ansible_distribution_file_parsed": true, "ansible_distribution_file_search_string": "Red Hat", "ansible_os_family": "RedHat", "ansible_fips": false, "ansible_virtualization_type": "xen", "ansible_virtualization_role": "guest", "ansible_interfaces": ["eth0", "lo"], "ansible_lo": {"device": "lo", "mtu": 65536, "active": true, "type": "loopback", "promisc": false, "ipv4": {"address": "127.0.0.1", "broadcast": "host", "netmask": "255.0.0.0", "network": "127.0.0.0"}, "ipv6": [{"address": "::1", "prefix": "128", "scope": "host"}], "features": {"rx_checksumming": "on [fixed]", "tx_checksumming": "on", "tx_checksum_ipv4": "off [fixed]", "tx_checksum_ip_generic": "on [fixed]", "tx_checksum_ipv6": "off [fixed]", "tx_checksum_fcoe_crc": "off [fixed]", "tx_checksum_sctp": "on [fixed]", "scatter_gather": "on", "tx_scatter_gather": "on [fixed]", "tx_scatter_gather_fraglist": "on [fixed]", "tcp_segmentation_offload": "on", "tx_tcp_segmentation": "on", "tx_tcp_ecn_segmentation": "on", "tx_tcp_mangleid_segmentation": "on", "tx_tcp6_segmentation": "on", "generic_segmentation_offload": "on", "generic_receive_offload": "on", "large_receive_offload": "off [fixed]", "rx_vlan_offload": "off [fixed]", "tx_vlan_offload": "off [fixed]", "ntuple_filters": "off [fixed]", "receive_hashing": "off [fixed]", "highdma": "on [fixed]", "rx_vlan_filter": "off [fixed]", "vlan_challenged": "on [fixed]", "tx_lockless": "on [fixed]", "netns_local": "on [fixed]", "tx_gso_robust": "off [fixed]", "tx_fcoe_segmentation": "off [fixed]", "tx_gre_segmentation": "off [fixed]", "tx_gre_csum_segmentation": "off [fixed]", "tx_ipxip4_segmentation": "off [fixed]", "tx_ipxip6_segmentation": "off [fixed]", "tx_udp_tnl_segmentation": "off [fixed]", "tx_udp_tnl_csum_segmentation": "off [fixed]", "tx_gso_partial": "off [fixed]", "tx_sctp_segmentation": "on", "tx_esp_segmentation": "off [fixed]", "tx_udp_segmentation": "off [fixed]", "tls_hw_rx_offload": "off [fixed]", "fcoe_mtu": "off [fixed]", "tx_nocache_copy": "off [fixed]", "loopback": "on [fixed]", "rx_fcs": "off [fixed]", "rx_all": "off [fixed]", "tx_vlan_stag_hw_insert": "off [fixed]", "rx_vlan_stag_hw_parse": "off [fixed]", "rx_vlan_stag_filter": "off [fixed]", "l2_fwd_offload": "off [fixed]", "hw_tc_offload": "off [fixed]", "esp_hw_offload": "off [fixed]", "esp_tx_csum_hw_offload": "off [fixed]", "rx_udp_tunnel_port_offload": "off [fixed]", "tls_hw_tx_offload": "off [fixed]", "rx_gro_hw": "off [fixed]", "tls_hw_record": "off [fixed]"}, "timestamping": ["tx_software", "rx_software", "software"], "hw_timestamp_filters": []}, "ansible_eth0": {"device": "eth0", "macaddress": "02:9d:f0:e8:bc:77", "mtu": 9001, "active": true, "module": "xen_netfront", "type": "ether", "pciid": "vif-0", "promisc": false, "ipv4": {"address": "172.31.23.42", "broadcast": "172.31.31.255", "netmask": "255.255.240.0", "network": "172.31.16.0"}, "ipv6": [{"address": "fe80::9d:f0ff:fee8:bc77", "prefix": "64", "scope": "link"}], "features": {"rx_checksumming": "on [fixed]", "tx_checksumming": "on", "tx_checksum_ipv4": "on [fixed]", "tx_checksum_ip_generic": "off [fixed]", "tx_checksum_ipv6": "on", "tx_checksum_fcoe_crc": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "scatter_gather": "on", "tx_scatter_gather": "on", "tx_scatter_gather_fraglist": "off [fixed]", "tcp_segmentation_offload": "on", "tx_tcp_segmentation": "on", "tx_tcp_ecn_segmentation": "off [fixed]", "tx_tcp_mangleid_segmentation": "off", "tx_tcp6_segmentation": "on", "generic_segmentation_offload": "on", "generic_receive_offload": "on", "large_receive_offload": "off [fixed]", "rx_vlan_offload": "off [fixed]", "tx_vlan_offload": "off [fixed]", "ntuple_filters": "off [fixed]", "receive_hashing": "off [fixed]", "highdma": "off [fixed]", "rx_vlan_filter": "off [fixed]", "vlan_challenged": "off [fixed]", "tx_lockless": "off [fixed]", "netns_local": "off [fixed]", "tx_gso_robust": "on [fixed]", "tx_fcoe_segmentation": "off [fixed]", "tx_gre_segmentation": "off [fixed]", "tx_gre_csum_segmentation": "off [fixed]", "tx_ipxip4_segmentation": "off [fixed]", "tx_ipxip6_segmentation": "off [fixed]", "tx_udp_tnl_segmentation": "off [fixed]", "tx_udp_tnl_csum_segmentation": "off [fixed]", "tx_gso_partial": "off [fixed]", "tx_sctp_segmentation": "off [fixed]", "tx_esp_segmentation": "off [fixed]", "tx_udp_segmentation": "off [fixed]", "tls_hw_rx_offload": "off [fixed]", "fcoe_mtu": "off [fixed]", "tx_nocache_copy": "off", "loopback": "off [fixed]", "rx_fcs": "off [fixed]", "rx_all": "off [fixed]", "tx_vlan_stag_hw_insert": "off [fixed]", "rx_vlan_stag_hw_parse": "off [fixed]", "rx_vlan_stag_filter": "off [fixed]", "l2_fwd_offload": "off [fixed]", "hw_tc_offload": "off [fixed]", "esp_hw_offload": "off [fixed]", "esp_tx_csum_hw_offload": "off [fixed]", "rx_udp_tunnel_port_offload": "off [fixed]", "tls_hw_tx_offload": "off [fixed]", "rx_gro_hw": "off [fixed]", "tls_hw_record": "off [fixed]"}, "timestamping": ["rx_software", "software"], "hw_timestamp_filters": []}, "ansible_default_ipv4": {"gateway": "172.31.16.1", "interface": "eth0", "address": "172.31.23.42", "broadcast": "172.31.31.255", "netmask": "255.255.240.0", "network": "172.31.16.0", "macaddress": "02:9d:f0:e8:bc:77", "mtu": 9001, "type": "ether", "alias": "eth0"}, "ansible_default_ipv6": {}, "ansible_all_ipv4_addresses": ["172.31.23.42"], "ansible_all_ipv6_addresses": ["fe80::9d:f0ff:fee8:bc77"], "ansible_iscsi_iqn": "", "ansible_processor": ["0", "GenuineIntel", "Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz"], "ansible_processor_count": 1, "ansible_processor_cores": 1, "ansible_processor_threads_per_core": 1, "ansible_processor_vcpus": 1, "ansible_memtotal_mb": 815, "ansible_memfree_mb": 280, "ansible_swaptotal_mb": 0, "ansible_swapfree_mb": 0, "ansible_memory_mb": {"real": {"total": 815, "used": 535, "free": 280}, "nocache": {"free": 613, "used": 202}, "swap": {"total": 0, "free": 0, "used": 0, "cached": 0}}, "ansible_bios_date": "08/24/2006", "ansible_bios_version": "4.2.amazon", "ansible_form_factor": "Other", "ansible_product_name": "HVM domU", "ansible_product_serial": "NA", "ansible_product_uuid": "NA", "ansible_product_version": "4.2.amazon", "ansible_system_vendor": "Xen", "ansible_devices": {"xvda": {"virtual": 1, "links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "vendor": null, "model": null, "sas_address": null, "sas_device_handle": null, "removable": "0", "support_discard": "0", "partitions": {"xvda2": {"links": {"ids": [], "uuids": ["3510a17e-27dc-4ae2-9243-d600c16f4106"], "labels": [], "masters": []}, "start": "4096", "sectors": "20967391", "sectorsize": 512, "size": "10.00 GB", "uuid": "3510a17e-27dc-4ae2-9243-d600c16f4106", "holders": []}, "xvda1": {"links": {"ids": [], "uuids": [], "labels": [], "masters": []}, "start": "2048", "sectors": "2048", "sectorsize": 512, "size": "1.00 MB", "uuid": null, "holders": []}}, "rotational": "0", "scheduler_mode": "mq-deadline", "sectors": "20971520", "sectorsize": "512", "size": "10.00 GB", "host": "", "holders": []}}, "ansible_device_links": {"ids": {}, "uuids": {"xvda2": ["3510a17e-27dc-4ae2-9243-d600c16f4106"]}, "labels": {}, "masters": {}}, "ansible_uptime_seconds": 4422, "ansible_mounts": [{"mount": "/", "device": "/dev/xvda2", "fstype": "xfs", "options": "rw,seclabel,relatime,attr2,inode64,noquota", "size_total": 10724814848, "size_available": 9497722880, "block_size": 4096, "block_total": 2618363, "block_available": 2318780, "block_used": 299583, "inode_total": 5241840, "inode_available": 5208528, "inode_used": 33312, "uuid": "3510a17e-27dc-4ae2-9243-d600c16f4106"}], "ansible_local": {}, "ansible_fibre_channel_wwn": [], "ansible_system_capabilities_enforced": "True", "ansible_system_capabilities": [""], "ansible_python": {"version": {"major": 3, "minor": 6, "micro": 8, "releaselevel": "final", "serial": 0}, "version_info": [3, 6, 8, "final", 0], "executable": "/usr/libexec/platform-python", "has_sslcontext": true, "type": "cpython"}, "ansible_cmdline": {"BOOT_IMAGE": "(hd0,msdos2)/boot/vmlinuz-4.18.0-193.el8.x86_64", "root": "UUID=3510a17e-27dc-4ae2-9243-d600c16f4106", "ro": true, "console": "tty0", "net.ifnames": "0", "rd.blacklist": "nouveau", "nvme_core.io_timeout": "4294967295", "crashkernel": "auto"}, "ansible_proc_cmdline": {"BOOT_IMAGE": "(hd0,msdos2)/boot/vmlinuz-4.18.0-193.el8.x86_64", "root": "UUID=3510a17e-27dc-4ae2-9243-d600c16f4106", "ro": true, "console": ["ttyS0,115200n8", "tty0"], "net.ifnames": "0", "rd.blacklist": "nouveau", "nvme_core.io_timeout": "4294967295", "crashkernel": "auto"}, "ansible_is_chroot": false, "ansible_date_time": {"year": "2020", "month": "08", "weekday": "Tuesday", "weekday_number": "2", "weeknumber": "34", "day": "25", "hour": "09", "minute": "12", "second": "46", "epoch": "1598346766", "date": "2020-08-25", "time": "09:12:46", "iso8601_micro": "2020-08-25T09:12:46.165799Z", "iso8601": "2020-08-25T09:12:46Z", "iso8601_basic": "20200825T091246165668", "iso8601_basic_short": "20200825T091246", "tz": "UTC", "tz_offset": "+0000"}, "ansible_selinux_python_present": true, "ansible_selinux": {"status": "enabled", "policyvers": 31, "config_mode": "enforcing", "mode": "enforcing", "type": "targeted"}, "ansible_apparmor": {"status": "disabled"}, "ansible_env": {"LS_COLORS": "rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=01;05;37;41:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;40:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.zst=38;5;9:*.tzst=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.wim=38;5;9:*.swm=38;5;9:*.dwm=38;5;9:*.esd=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.mjpg=38;5;13:*.mjpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.m4a=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.oga=38;5;45:*.opus=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:", "SSH_CONNECTION": "172.31.18.236 33608 172.31.23.42 22", "_": "/usr/libexec/platform-python", "LANG": "en_US.UTF-8", "XDG_SESSION_ID": "39", "USER": "ansible", "SELINUX_ROLE_REQUESTED": "", "PWD": "/home/ansible", "HOME": "/home/ansible", "SSH_CLIENT": "172.31.18.236 33608 22", "SELINUX_LEVEL_REQUESTED": "", "SSH_TTY": "/dev/pts/1", "SHELL": "/bin/bash", "TERM": "xterm-256color", "SELINUX_USE_CURRENT_RANGE": "", "SHLVL": "2", "LOGNAME": "ansible", "DBUS_SESSION_BUS_ADDRESS": "unix:path=/run/user/1001/bus", "XDG_RUNTIME_DIR": "/run/user/1001", "PATH": "/home/ansible/.local/bin:/home/ansible/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin", "LESSOPEN": "||/usr/bin/lesspipe.sh %s"}, "ansible_pkg_mgr": "dnf", "ansible_hostnqn": "", "ansible_service_mgr": "systemd", "gather_subset": ["all"], "module_setup": true}, "invocation": {"module_args": {"gather_subset": ["all"], "gather_timeout": 10, "filter": "*", "fact_path": "/etc/ansible/facts.d"}}}\r\n', b'Shared connection to ec2-3-249-227-122.eu-west-1.compute.amazonaws.com closed.\r\n')
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ce7441570e ec2-3-249-227-122.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1598346765.0777154-5325-64035331839151/ > /dev/null 2>&1 && sleep 0'"'"''
<ec2-3-249-227-122.eu-west-1.compute.amazonaws.com> (0, b'', b'')
ok: [ec2-3-249-227-122.eu-west-1.compute.amazonaws.com]
META: ran handlers

TASK [Transfering from between servers using delegate] ***************************************************************************************************************************************************************************************
task path: /home/ansible/sync.yml:5
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'echo ~ansible && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'/home/ansible\n', b'')
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansible/.ansible/tmp `"&& mkdir /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087 && echo ansible-tmp-1598346766.6341565-5347-13073173533087="` echo /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087 `" ) && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'ansible-tmp-1598346766.6341565-5347-13073173533087=/home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087\n', b'')
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> Attempting python interpreter discovery
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'PLATFORM\nLinux\nFOUND\n/usr/libexec/platform-python\nENDFOUND\n', b'')
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'/usr/libexec/platform-python && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'{"platform_dist_result": ["redhat", "8.2", "Ootpa"], "osrelease_content": "NAME=\\"Red Hat Enterprise Linux\\"\\nVERSION=\\"8.2 (Ootpa)\\"\\nID=\\"rhel\\"\\nID_LIKE=\\"fedora\\"\\nVERSION_ID=\\"8.2\\"\\nPLATFORM_ID=\\"platform:el8\\"\\nPRETTY_NAME=\\"Red Hat Enterprise Linux 8.2 (Ootpa)\\"\\nANSI_COLOR=\\"0;31\\"\\nCPE_NAME=\\"cpe:/o:redhat:enterprise_linux:8.2:GA\\"\\nHOME_URL=\\"https://www.redhat.com/\\"\\nBUG_REPORT_URL=\\"https://bugzilla.redhat.com/\\"\\n\\nREDHAT_BUGZILLA_PRODUCT=\\"Red Hat Enterprise Linux 8\\"\\nREDHAT_BUGZILLA_PRODUCT_VERSION=8.2\\nREDHAT_SUPPORT_PRODUCT=\\"Red Hat Enterprise Linux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"8.2\\"\\n"}\n', b'')
Using module file /usr/lib/python3.6/site-packages/ansible/modules/files/synchronize.py
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> PUT /home/ansible/.ansible/tmp/ansible-local-5318rvb_n_o4/tmp2opbxma7 TO /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087/AnsiballZ_synchronize.py
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb '[ec2-3-249-85-67.eu-west-1.compute.amazonaws.com]'
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'sftp> put /home/ansible/.ansible/tmp/ansible-local-5318rvb_n_o4/tmp2opbxma7 /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087/AnsiballZ_synchronize.py\n', b'')
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'chmod u+x /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087/ /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087/AnsiballZ_synchronize.py && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'', b'')
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb -tt ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'/usr/libexec/platform-python /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087/AnsiballZ_synchronize.py && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (1, b'\r\n{"rc": 2, "msg": "[Errno 2] No such file or directory: b\'sshpass\': b\'sshpass\'", "cmd": "sshpass", "failed": true, "exception": "  File \\"/tmp/ansible_synchronize_payload_zoiutoi7/ansible_synchronize_payload.zip/ansible/module_utils/basic.py\\", line 2588, in run_command\\n    cmd = subprocess.Popen(args, **kwargs)\\n  File \\"/usr/lib64/python3.6/subprocess.py\\", line 729, in __init__\\n    restore_signals, start_new_session)\\n  File \\"/usr/lib64/python3.6/subprocess.py\\", line 1364, in _execute_child\\n    raise child_exception_type(errno_num, err_msg, err_filename)\\n", "invocation": {"module_args": {"src": "/tmp/testdir", "dest": "ansible@ec2-3-249-227-122.eu-west-1.compute.amazonaws.com:/tmp", "_local_rsync_path": "rsync", "_local_rsync_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "rsync_path": null, "delete": false, "_substitute_controller": false, "archive": true, "checksum": false, "compress": true, "existing_only": false, "dirs": false, "copy_links": false, "set_remote_user": true, "rsync_timeout": 0, "rsync_opts": [], "partial": false, "verify_host": false, "mode": "push", "dest_port": null, "private_key": null, "recursive": null, "links": null, "perms": null, "times": null, "owner": null, "group": null, "ssh_args": null, "link_dest": null}}}\r\n', b'Shared connection to ec2-3-249-85-67.eu-west-1.compute.amazonaws.com closed.\r\n')
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> Failed to connect to the host via ssh: Shared connection to ec2-3-249-85-67.eu-west-1.compute.amazonaws.com closed.
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> ESTABLISH SSH CONNECTION FOR USER: ansible
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> SSH: EXEC sshpass -d9 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="ansible"' -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/d302bd36fb ec2-3-249-85-67.eu-west-1.compute.amazonaws.com '/bin/sh -c '"'"'rm -f -r /home/ansible/.ansible/tmp/ansible-tmp-1598346766.6341565-5347-13073173533087/ > /dev/null 2>&1 && sleep 0'"'"''
<ec2-3-249-85-67.eu-west-1.compute.amazonaws.com> (0, b'', b'')
The full traceback is:
  File "/tmp/ansible_synchronize_payload_zoiutoi7/ansible_synchronize_payload.zip/ansible/module_utils/basic.py", line 2588, in run_command
    cmd = subprocess.Popen(args, **kwargs)
  File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
fatal: [ec2-3-249-227-122.eu-west-1.compute.amazonaws.com -> ec2-3-249-85-67.eu-west-1.compute.amazonaws.com]: FAILED! => {
    "changed": false,
    "cmd": "sshpass",
    "invocation": {
        "module_args": {
            "_local_rsync_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "_local_rsync_path": "rsync",
            "_substitute_controller": false,
            "archive": true,
            "checksum": false,
            "compress": true,
            "copy_links": false,
            "delete": false,
            "dest": "ansible@ec2-3-249-227-122.eu-west-1.compute.amazonaws.com:/tmp",
            "dest_port": null,
            "dirs": false,
            "existing_only": false,
            "group": null,
            "link_dest": null,
            "links": null,
            "mode": "push",
            "owner": null,
            "partial": false,
            "perms": null,
            "private_key": null,
            "recursive": null,
            "rsync_opts": [],
            "rsync_path": null,
            "rsync_timeout": 0,
            "set_remote_user": true,
            "src": "/tmp/testdir",
            "ssh_args": null,
            "times": null,
            "verify_host": false
        }
    },
    "msg": "[Errno 2] No such file or directory: b'sshpass': b'sshpass'",
    "rc": 2
}

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
ec2-3-249-227-122.eu-west-1.compute.amazonaws.com : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

$ 
maxamillion commented 3 years ago

Hello! Thank you for the bug report. Using Ansible version 2.9.13 with the ansible.posix collection version 1.1.1 I'm not able to reproduce this issue, is there any more information that you could provide that might help me reproduce this locally in order to fix the issue?

lucas-benedito commented 3 years ago

Hello, The issue is only reproducible in RHEL8 servers and the playbook was used as mentioned in the example, using the synchronize module existent in the installation. Also, the issue only happens when using ssh password but works successfully when using ssh-key.

gundalow commented 3 years ago

@lucas-benedito Thank you for the feedback. Seems like there are a few variables at play

Does it fail on non RHEL8 machines with ssh password?

lucas-benedito commented 3 years ago

@gundalow from the tests performed I was only able to reproduce it in RHEL8.

saito-hideki commented 2 years ago

Hi @lucas-benedito :) I have replicated a similar issue on the following test environment(2.9.11,2.9.27 and 2.12.0 on RHEL8.5):

Environment:

Control Node: server10 (RHEL8.5) ansible(2.9.11, 2.9.27 and 2.12.0), sshpass, rsync
Managed Node: server11 (RHEL8.5) rsync
Delegate To:  server12 (RHEL8.5) rsync

Playbook(issue_89.yml):

---
- name: Sync between servers
  hosts: issue_89
  tasks:
  - file:
      path: /tmp/testdir
      state: absent

  - name: Transfering from between servers using delegate
    synchronize:
      src: /tmp/testdir
      dest: /tmp
    delegate_to: server12

Inventory File(inventory):

[issue_89]
server11

Error Message:

$ ansible-playbook -i inventory playbook/issue_89.yml -k -vvv
...snip...
The full traceback is:
  File "/tmp/ansible_synchronize_payload_qob31y7j/ansible_synchronize_payload.zip/ansible/module_utils/basic.py", line 2588, in run_command
    cmd = subprocess.Popen(args, **kwargs)
  File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
fatal: [server11 -> server12]: FAILED! => {
    "changed": false,
    "cmd": "sshpass",
    "invocation": {
        "module_args": {
...snip...
        }
    },
    "msg": "[Errno 2] No such file or directory: b'sshpass': b'sshpass'",
    "rc": 2
}

Once I installed sshpass to delegate_to host server12, it worked without errors. So if it is possible, can you re-confirm that sshpass package has already been installed to your delegatet_to host or not?

spuder commented 2 years ago

I can reproduce this on OSX running ansible.posix.synchronize against a raspberry pi

OSX

uname -a
Darwin spuder.local 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000 arm64

Raspberry Pi

Using the fluiddpi image based on Rasbian

pi@fluiddpi:~ $cat /etc/issue
Raspbian GNU/Linux 10 \n \l

pi@fluiddpi:~ $ uname -a
Linux fluiddpi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux

Ansible

ansible [core 2.12.2]
  config file = None
  configured module search path = ['/Users/spencer.owen/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/5.3.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/spencer.owen/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.10.2 (main, Feb  2 2022, 05:51:25) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True

Playbook

- name: Update klipper config
  hosts: ender2pro
  remote_user: root
  gather_facts: no
  tasks:
  - name: Synchronize macros folder
    ansible.posix.synchronize:
      src: macros/
      dest: /home/pi/klipper_config/macros/

I am using ssh password auth with paramiko

ansible-playbook -i inventory playbook.yaml -c paramiko --ask-pass

Workaround

Don't use password based authentication. Either install sshpass or setup ssh keys with ssh-copy-id

macau23 commented 2 years ago

I had the same problem (and workaround) - but is there a way to tell Ansible in the playbook to re-establish the ssh connection (without ask-pass) after the key has been written?

sugitk commented 1 year ago

I also reproduced this issue against RHEL 7.6 as well.

cybernet commented 1 year ago

I have the same issue on RHEL9

I'm trying to sync files from local to 2 others ( through ssh with key auth ) and it fails on both

part of playbook

- name: Synchronization using rsync protocol on delegate host (push)
  ansible.posix.synchronize:
    src: "/home/play/tmp/"
    dest: "ssh://{{ mta_servers }}/tmp"
  loop: "{{ groups['mta'] }}"
  loop_control:
    loop_var: mta_servers
  run_once: true
  register: sync_files
#  delegate_to: local
TASK [local : Synchronization using rsync protocol on delegate host (push)] ************************************************************************************************************************************
task path: /home/play/ansible/roles/local/tasks/rsync_stuff.yml:20
<10.1.0.4> ESTABLISH LOCAL CONNECTION FOR USER: play
<10.1.0.4> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/play/.ansible/tmp/ansible-local-58642k_j57v48 `"&& mkdir "` echo /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545 `" && echo ansible-tmp-1677790164.8864932-59133-200124832178545="` echo /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545 `" ) && sleep 0'
Using module file /usr/lib/python3.9/site-packages/ansible_collections/ansible/posix/plugins/modules/synchronize.py
<10.1.0.4> PUT /home/play/.ansible/tmp/ansible-local-58642k_j57v48/tmpqg8o39ez TO /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545/AnsiballZ_synchronize.py
<10.1.0.4> EXEC /bin/sh -c 'chmod u+x /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545/ /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545/AnsiballZ_synchronize.py && sleep 0'
<10.1.0.4> EXEC /bin/sh -c '/usr/bin/python3.9 /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545/AnsiballZ_synchronize.py && sleep 0'
<10.1.0.4> EXEC /bin/sh -c 'rm -f -r /home/play/.ansible/tmp/ansible-local-58642k_j57v48/ansible-tmp-1677790164.8864932-59133-200124832178545/ > /dev/null 2>&1 && sleep 0'
failed: [10.1.0.4] (item=10.1.0.3) => {
    "ansible_loop_var": "mta_servers",
    "changed": false,
    "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -i /home/play/.ssh/pwned -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --out-format='<<CHANGED>>%i %n%L' /home/play/tmp/ root@10.1.0.4:ssh://10.1.0.3/tmp",
    "invocation": {
        "module_args": {
            "_local_rsync_password": null,
            "_local_rsync_path": "rsync",
            "_substitute_controller": false,
            "archive": true,
            "checksum": false,
            "compress": true,
            "copy_links": false,
            "delay_updates": true,
            "delete": false,
            "dest": "root@10.1.0.4:ssh://10.1.0.3/tmp",
            "dest_port": null,
            "dirs": false,
            "existing_only": false,
            "group": null,
            "link_dest": null,
            "links": null,
            "mode": "push",
            "owner": null,
            "partial": false,
            "perms": null,
            "private_key": "/home/play/.ssh/pwned",
            "recursive": null,
            "rsync_opts": [],
            "rsync_path": null,
            "rsync_timeout": 0,
            "set_remote_user": true,
            "src": "/home/play/tmp/",
            "ssh_args": null,
            "ssh_connection_multiplexing": false,
            "times": null,
            "verify_host": false
        }
    },
    "msg": "Warning: Permanently added '10.1.0.4' (ED25519) to the list of known hosts.\r\nrsync: [Receiver] mkdir \"/root/ssh://10.1.0.3/tmp\" failed: No such file or directory (2)\nrsync error: error in file IO (code 11) at main.c(783) [Receiver=3.2.3]\n",
    "mta_servers": "10.1.0.3",
    "rc": 11
}