Search code examples
ansiblerolesjitsi

Ansible roles with folder "files"


I have a role Jitsi. I want to copy file logo.png from folder logo, also js.name.com.crt and js.name.com.key to remote host

/etc/ansible/roles/Jitsi/files# tree

.
├── logo
│   └── logo.png
└── ssl
    ├── js.name.com.crt
    └── js.name.com.key

I have a task for logo:

- name: Copy files logo.png
  copy:
    src: /etc/ansible/roles/Jitsi/files/logo/logo.png
    dest: /usr/share/jitsi-meet/images/watermark.png
    remote_src: true

And task for ssl:

- name: Copy cert file js.name.com.crt
  copy:
    src: /etc/ansible/roles/Jitsi/files/ssl/js.name.com.crt
    dest: /etc/ssl/js.name.com.crt
    remote_src: true

- name: Copy  key file js.name.com.key
  copy:
    src: /etc/ansible/roles/Jitsi/files/ssl/js.name.com.key
    dest: /etc/ssl/js.name.com.key
    remote_src: true

But when I execute my playbook, I get error:

TASK [Copy cert file js.name.com.crt] ***************************************************************************************
fatal: [jitsi]: FAILED! => {"changed": false, "msg": "Source /etc/ansible/roles/Jitsi/files/ssl/js.name.com.crt not found"}

P.S. Maybe I can use some variables for this?


Solution

  • The copy module copies a file from the local or remote machine to a location on the remote machine. local or remote depends of value of parameter remote_src

    remote_src if no, it will search for src on the controller node. If yes it will search for src on the managed (remote) node.

    so following the name of your file defined in the src parameter, i suppose your file is on controller node (localhost), so i suggest you to set no the remote_src