Ansible copy module: src (or content) is required
Sunday, January 10 2021 · Lesezeit: 1 Minuten · 126 Wörter · Tags: ansible Achtung! Dieser Artikel ist älter als ein Jahr. Der Inhalt ist möglicherweise nicht mehr aktuell!In case your ansible task looks like this:
- name: Copy WebGUI TLS private key
copy:
src: "{{ syncthing_gui_tls_private_path }}"
dest: "/home/{{ syncthing_user }}/.config/syncthing/https-key.pem"
owner: "{{ syncthing_user }}"
group: "{{ syncthing_group }}"
remote_src: true
mode: "0600"
notify: Restart syncthing
but produces this message:
fatal: [yourhost]: FAILED! => {“changed”: false, “msg”: “src (or content) is required”}
Don’t get crazy! I know you used the copy module thousands of times just like me. Check the following:
- Make sure you wrote
src
instead ofscr
- Make sure your variable is populated! In my case mine was just empty:
syncthing_gui_tls_private_path:
After adding the path it was working again. Seems like empty variables are not passed to the module triggering that error. Took me 20 minutes until I figured it out.
Du hast einen Kommentar, einen Wunsch oder eine Verbesserung? Schreib mir doch eine E-Mail! Die Infos dazu stehen hier.
🖇️ = Link zu anderer Webseite
🔐 = Webseite nutzt HTTPS (verschlüsselter Transportweg) Zurück