i have a playbook with a task that should fetch me the content of a file on
host 1 load it into a directory (drop) and the following task should copy
the content of the drop directoy and copy it to another file on host 2
here is my playbook:
---
- name: Exchange Keys between servers
hosts: test_servers
become: true
become_method: sudo
tasks:
# - name: SSH KeyGen command
# openssh_keypair:
# path: /home/osboxes/.ssh/id_rsa
# force: false
- name: Fetch the file from the host1 to master
run_once: yes
fetch:
src: /home/osboxes/.ssh/id_rsa.pub
dest: /home/osboxes/drop/
flat: yes
when: "{{ inventory_hostname == 'test1' }}"
- name: Copy the file from master to host2
copy: src=/home/osboxes/drop/idrsa.pub
dest=/home/osboxes/.ssh/authorized_keys
when: "{{ inventory_hostname == 'test2' }}"
but for some reason the playbook cant access the drop directory on my
ansible control node and i get this error massage
TASK [Fetch the file from the host1 to master]
******************************************************************************************************************************************************************
[WARNING]: conditional statements should not include jinja2 templating
delimiters such as {{ }} or {% %}. Found: {{ inventory_hostname == 'test1'
}}
fatal: [test1]: FAILED! => {"changed": false, "msg": "Failed to fetch the
file: [Errno 13] Permission denied: '/home/osboxes/drop/id_rsa.pub'"}
Could somebody tell me what im doing wrong bc i cant find a working
solution in google
--
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/82e2318d-a05c-44dc-b326-931e6409e65dn%40googlegroups.com.