I am attemping o copy a file from one remote linux server to two remote linux servers. My playbook is:
hosts: “remote source server”
gather_facts: false
tasks:
copy:
src: /opt/odrive/alc/library/libraryusername.csv
remote_src: yes
dest: /var/alc
delegate_to: destination server 1
check_mode: yes
copy:
src: /opt/odrive/alc/library/libraryusername.csv
remote_src: yes
dest: /var/alc
delegate_to: destination server 2
check_mode: yes
I get the following error despite the file being there.
“msg”: “Source /opt/odrive/alc/library/libraryusername.csv not found”
What am I missing?
Thank you,
dulhaver
(Gunnar)
December 1, 2021, 5:51pm
2
I am attemping o copy a file from one remote linux server to two remote linux servers. My playbook is:
hosts: “remote source server”
gather_facts: false
tasks:
copy:
src: /opt/odrive/alc/library/libraryusername.csv
remote_src: yes
dest: /var/alc
delegate_to: destination server 1
check_mode: yes
copy:
src: /opt/odrive/alc/library/libraryusername.csv
remote_src: yes
dest: /var/alc
delegate_to: destination server 2
check_mode: yes
I get the following error despite the file being there.
“msg”: “Source /opt/odrive/alc/library/libraryusername.csv not found”
What am I missing?
Thank you,
Thank you for the response. I made the change but still getting the same error.
Rene
Further to this I created a quick check for file playbook as below and it does find it and displays the content successfully. So the copy script is just not functional. Any ideas as to why it does not find the file?
name: check if file exists
hosts: source server
gather_facts: true
tasks:
path: /opt/odrive/alc/library
register: result
src: /opt/odrive/alc/library/libraryusername.csv
register: result
when: result.stat.exists
msg: “{{ result.content|b64decode }}”
racke
(Stefan Hornburg)
December 2, 2021, 9:42am
5
I am attemping o copy a file from one remote linux server to two remote linux servers. My playbook is:
- name: copy file
hosts: “remote source server”
gather_facts: false
tasks:
\- name: "copy "
copy:
src: /opt/odrive/alc/library/libraryusername\.csv
remote\_src: yes
dest: /var/alc
delegate\_to: destination server 1
check\_mode: yes
\- name: "copy "
copy:
src: /opt/odrive/alc/library/libraryusername\.csv
remote\_src: yes
dest: /var/alc
delegate\_to: destination server 2
check\_mode: yes
I get the following error despite the file being there.
"msg": "Source /opt/odrive/alc/library/libraryusername.csv not found"
What am I missing?
The copy module only supports the controller or target itself (remote_src) for the source file.
Take a look at the synchronize module if you want copy from one target to another.
Regards
Racke
I have changed my playbook to use the sync module. But again I am getting errors. Check mode is so I can test before the actual sync. I am using the ansible.posix.synchronize module which I downloaded and installed.
Playbook