Open amurchick opened 2 years ago
Have the same issue, my temporary workaround:
- name: test
hosts: host
vars:
ssh_port: 2222
ansible_port: "{{ ssh_port }}"
tasks:
- name: sync
ansible.posix.synchronize:
dest_port: "{{ lookup('ansible.builtin.vars', 'ansible_port') }}"
mode: pull
src: user@host/file
dest: ~/
Issue title here is about ansible_host
, shouldn't it should be ansible_port
?
Got the same issue with ansible_user
, probably occurs with all connection parameters.
SUMMARY
Module raise error, if
ansible_port
is jinja expression:ISSUE TYPE
COMPONENT NAME
synchronize
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
MacOS/12.4 (21F79)/M1 (this is not OS specific issue)
STEPS TO REPRODUCE
EXPECTED RESULTS
All works. (if in PB uncomment line
# dest_port: "{{ ansible_port }}"
or comment lineansible_port: "{{ ssh_port }}"
- all worked fine)ACTUAL RESULTS
Jinja expression "{{ ssh_port }}" of variable
ansible_port
not substituted and sends to module as string (see below linedest_port: '{{ ssh_port }}'
): https://github.com/ansible-collections/ansible.posix/blob/a65807edc322ec403eb73e006aa9f6e2172026a3/plugins/action/synchronize.py#L265-L268