Hello!
I have 2 remote hosts and 1 master node with my playbooks. I want that file
with name ".env" was copy with module "Fetch" to Master node and then, with
module "copy" will copy to Remote host 2
*hosts:*
[jitsi]
185.139.68.189
[VideoBridge2]
46.17.104.103
[Jitsi_Stack]
185.139.68.189
46.17.104.103
[jitsi:vars]
ansible_python_interpreter=/usr/bin/python3
[VideoBridge2:vars]
ansible_python_interpreter=/usr/bin/python3
*My playbook:*
---
- hosts: Jitsi_Stack
tasks:
- name: fetch /home/docker-jitsi-meet/.env
fetch:
src: /home/docker-jitsi-meet/.env
dest: /home/
flat: true
when: inventory_hostname == "185.139.68.189"
- name: Copy the file from master to VideoBridge2
copy:
src: /home/.env
dest: /home/
when: inventory_hostname == "46.17.104.103"
But it does not work:
root@lxd02:/etc/ansible/playbook/VideoBridges# ansible-playbook -vv
File_copy_from_host_to_host.yaml
ansible-playbook 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules',
'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
Using /etc/ansible/ansible.cfg as config file
PLAYBOOK: File_copy_from_host_to_host.yaml
**************************************************************************
1 plays in File_copy_from_host_to_host.yaml
PLAY [Jitsi_Stack]
**************************************************************************************************
TASK [Gathering Facts]
**********************************************************************************************
task path:
/etc/ansible/playbook/VideoBridges/File_copy_from_host_to_host.yaml:2
ok: [185.139.68.189]
ok: [46.17.104.103]
META: ran handlers
TASK [fetch /home/docker-jitsi-meet/.env]
***************************************************************************
task path:
/etc/ansible/playbook/VideoBridges/File_copy_from_host_to_host.yaml:6
changed: [185.139.68.189] => {"changed": true, "checksum":
"b445c33c0e4e59ef8624d22060cdbeb1e8953a86", "dest": "/home/.env", "md5sum":
"89718e47f6f1fa3817a707f88e7c3774", "remote_checksum":
"b445c33c0e4e59ef8624d22060cdbeb1e8953a86", "remote_md5sum": null}
fatal: [46.17.104.103]: FAILED! => {"changed": false, "msg": "file not
found: /home/docker-jitsi-meet/.env"}
TASK [Copy the file from master to VideoBridge2]
********************************************************************
task path:
/etc/ansible/playbook/VideoBridges/File_copy_from_host_to_host.yaml:13
ok: [185.139.68.189 -> localhost] => {"changed": false, "checksum":
"b445c33c0e4e59ef8624d22060cdbeb1e8953a86", "dest": "/home/.env", "gid": 0,
"group": "root", "mode": "0644", "owner": "root", "path": "/home/.env",
"size": 10437, "state": "file", "uid": 0}
META: ran handlers
META: ran handlers
PLAY RECAP
**********************************************************************************************************
185.139.68.189 : ok=3 changed=1 unreachable=0
failed=0 skipped=0 rescued=0 ignored=0
46.17.104.103 : ok=1 changed=0 unreachable=0
failed=1 skipped=0 rescued=0 ignored=0
Could you please help to solve this issue?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/60180ff9-eb2b-414d-bc5c-1608f9e26e14n%40googlegroups.com.