Ansible copy module: src (or content) is required

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
      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:

  1. Make sure you wrote src instead of scr
  2. Make sure your variable is populated! In my case mine was just empty:


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)