Open samweisgamdschie opened 15 hours ago
One more thing: sad but true, our (actually) longest ansible_ssh_common_args
setup looks like this:
{
"ansible_private_key_file": "{{ lookup(\"env\",\"JH6_SSH_PRIVATE_KEY\") }}",
"ansible_ssh_common_args": "-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oProxyCommand=\"ssh -i {{ lookup(\"env\",\"JH6_SSH_PRIVATE_KEY\") }} -W %h:%p -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oProxyCommand=\\\"ssh -i {{ lookup(\"env\",\"JH4_SSH_PRIVATE_KEY\") }} -W {{ jh6_ip }}:{{ jh6_ssh_port }} -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oProxyCommand=\\\\\\\"ssh -i {{ lookup(\"env\",\"JH1_SSH_PRIVATE_KEY\") }} -W {{ jh4_ip }}:{{ jh4_ssh_port }} -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null {{ jh1_ssh_user }}@{{ jh1_ip }}\\\\\\\" {{ jh4_ssh_user }}@{{ jh4_ip }}\\\" {{ jh6_ssh_user }}@{{ jh6_ip }}\"",
"ansible_ssh_user": "{{ jh6_ssh_user }}"
}
Which means, we need to handle at least triple quotes:
\\\\\\\"
in JSON, means
\\\"
in YAML, means
"""
in rsync's --rsh command parameter.
Welcome again in the escape hell, D'OH!
SUMMARY
According to the man page of rsync (e.g. https://ss64.com/bash/rsync_options.html)
--rsh=COMMAND
has an exotic way to handle quotation. E.g. quotation of the param list likeshould instead be escaped like
To be precise: an escaped single or double-quote should written
""
instead of\"
, with single quotes accordingly.Because we use such strings successfully as ansible_ssh_args for jumping we also need to have rsync handle that correctly.
ISSUE TYPE
COMPONENT NAME
synchronize
ANSIBLE VERSION
This is the Ansible distribution in container image ansible/awx-ee:24.5.0
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Container: ansible/awx-ee:24.5.0 Executed within AWX 24.5.0 With awx-operator 2.18.0
STEPS TO REPRODUCE
Use group vars like:
With a dest_host1 it works perfectly jumping to it via ssh and all tasks used like
but if we use synchronize like
EXPECTED RESULTS
This is what I get, when I replace the
\"
with""
in the command. After that, the --rsh parameter looks like the second described in the SUMMARY.ACTUAL RESULTS
with the same config for dest_host1, we get the following AWX output in json format:
The very same output I get, when I reproduce it in our dev environment. On commandline it says: