ansible.posix icon indicating copy to clipboard operation
ansible.posix copied to clipboard

Use synchronize in AAP's job failed

Open yalu678 opened this issue 1 year ago • 0 comments

SUMMARY

I have a job in AAP2.2. It is a ansible.posix.synchronize task. I have two issue.

  1. when I use password for accessing the remote server, it stuck in synchronize task like below, it seems waiting for input password.

EXEC /bin/sh -c '/usr/bin/python3.9 /home/runner/.ansible/tmp/ansible-local-215lpmq77v/ansible-tmp-1680144090.506961-49-264296656193385/AnsiballZ_synchronize.py && sleep 0'

  1. when I use sshkey for accessing the remote server, it can run the synchronize task, but it failed with below messages

    "msg": { "changed": false, "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --out-format='<<CHANGED>>%i %n%L' /tmp/a root@:/tmp/b", "failed": true, "msg": "Warning: Permanently added ',xx.xx.xx.xx' (ECDSA) to the list of known hosts.\r\nrsync: link_stat "/tmp/a" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]\n", <<<< no the source file /tmp/a(but actually exist in localhost)

My questions:

  1. how to solve the case when I use password to access remote server?

  2. Is the synchronize task supported in AAP's job? Note: I know in AAP's job, every playbook running in a container, then what the additional configure need in a AAP's template or other?

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ansible.posix.synchronize

ANSIBLE VERSION
ansible [core 2.13.8] provided by AAP 2.2

COLLECTION VERSION
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE

use below task in a AAP2.2 template and run.

- hosts: all
  tasks:
    - name: sync test
      ansible.posix.synchronize:
        src: /tmp/a
        dest: /tmp/b
      register: result
      ignore_errors: yes
    - name: debug result
      debug:
        msg: "{{ result }}"
EXPECTED RESULTS

execute successfully like ansible-playbook in commandline

when use commandline ansible-playbook , it is good(Neither with password or sshkey)

ok: [remoteserver] => {
    "msg": {
        "changed": true,
        "cmd": "/usr/bin/rsync --delay-updates -F --compress --archive --rsh='/usr/bin/ssh -S none -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' --out-format='<<CHANGED>>%i %n%L' /tmp/a remoteserver:/tmp/b",
        "failed": false,
        "msg": "<f..t...... a\n",
        "rc": 0,
        "stdout_lines": [
            "<f..t...... a"
        ]
    }
}
ACTUAL RESULTS
  1. stuck and hang in using password to access remote server.

  2. failed with "rsync: link_stat "/tmp/a" failed: No such file or directory (2)\nrsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]\n"

yalu678 avatar Mar 31 '23 09:03 yalu678