Hi Brian,
Thanks for the prompt reply.
For the template module, in 2.0.0-2.1.1, this worked:
- template:
src: templates/template-file.txt.j2
dest: ./subdirectory/result.txt
For 2.1.2 and later I have had to change this to:
- template:
src: templates/template-file.txt.j2
dest: ../subdirectory/result.txt
(Note the `..` as opposed to the `.` in the dest parameter)
Whether the cause is the same or different to `command: pwd`, the result
seems to be the same.
Regardless, I now know that the 2.0 to 2.1.1 behaviour is buggy, and I
should change playbooks to use the "fixed" behaviour.
Thanks so much for the help.
Steve
On Tuesday, 15 November 2016 12:03:51 UTC+11, Brian Coca wrote:
>
> First, not all paths are equal nor work the same way. The execution path,
> which is what you are getting when running `pwd`, depends on the connection
> plugin, it normally is the 'login directory' which for ssh is usually the
> remote $HOME. For most plugins this has not changed across versions.
>
> The 'local' connection plugin (default for localhost/local_action) had a
> bug introduced in 2.0 in which the path changed from 'playbook directory'
> to invocation path, 2.1.2 fixed that bug.
>
> This is what you are seeing in your tests, which do not really apply to
> the template plugin.
>
>
> The lookup and action plugins (like template and copy) have their own
> logic for finding paths (which has also had a few bugs). The way it is
> supposed to work is (given relative paths) to search based on role, include
> or playbook directory (more specific wins with fallback to parent). Also
> pre-pending 'files', 'vars' or 'templates' if needed and depending on the
> exact plugin. These are different than the 'execution path' detailed above.
>
>
> ----------
> Brian Coca
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/476de9ed-1fa0-4be8-970e-060461e52f06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.