Devo copiare il file dalla macchina A alla macchina B mentre la mia macchina di controllo da cui eseguo tutte le mie attività ansible è la macchina C (macchina locale)
Ho provato quanto segue:
Usa il comando scp nel modulo shell di ansible
hosts: machine2
user: user2
tasks:
- name: Copy file from machine1 to machine2
shell: scp user1@machine1:/path-of-file/file1 /home/user2/file1
Questo approccio va avanti e avanti non finisce mai.
usa fetch & copy moduli
hosts: machine1
user: user1
tasks:
- name: copy file from machine1 to local
fetch: src=/path-of-file/file1 dest=/path-of-file/file1
hosts: machine2
user: user2
tasks:
- name: copy file from local to machine2
copy: src=/path-of-file/file1 dest=/path-of-file/file1
Questo approccio mi genera un errore come segue:
error while accessing the file /Users/<myusername>/.ansible/cp/ansible-ssh-machine2-22-<myusername>, error was: [Errno 102] Operation not supported on socket: u'/Users/<myusername>/.ansible/cp/ansible-ssh-machine2-22-<myusername>'
Eventuali suggerimenti sarebbero utili.