Please keep the conversation on the list by reply to the list and not to
me personally.
On 23. sep. 2017 20:01, Torsten Crass wrote:
>> This is a feature that is being used a lot, but in you case the syntax
>> is not correct so I would think you get all sort of error messages.
>>
>> You need to remove the dash in front of src: and dest:
>
> Sigh, one more typo I introduced when making up this example... Of
> course, I originally didn't have hyphens in front of the yaml dictionary
> keys.
>
> No, ansible did explicitly complain about not finding a file inside a
> "files" subdirectory. Here's the original task that causes trouble:
>
> - name: copy gerbera build script
> become: true
> copy:
> src: usr/local/src/gerbera/build-gerbera.sh
> dest: usr/local/src/gerbera/build-gerbera.sh
> mode: ug+x
>
> This task lives in my root/roles/gerbera_server/tasks/main.yaml (with
> "root" denoting the root of the whole ansible project), while the source
> file lives in root/roles/gerbera_server/files/files/usr/local/src/gerbera/
Ansible is searching roles/gerbera_server/files
you have files two times, then you need to use
src: files/usr/local/src/gerbera/build-gerbera.sh
Your dest: is relative, that will probably fail, since it will be
relative to where you run ansible-playbook.
> When calling the gerbera_server role from my root/main.yaml file, I get:
>
> TASK [gerbera_server : copy gerbera build script]
> ******************************
> fatal: [priamos]: FAILED! => {"changed": false, "failed": true, "msg":
> "Unable to find 'usr/local/src/gerbera/build-gerbera.sh' in expected
> paths."}
>
> You're absolutely positive that paths relative to a role's "files"
> folder should work?
Yes, using the feature all the time.
--
Kai Stian Olstad