copy
and template
do not need to use relative path for src
. This removes the need for knowing the location of the root directory.
- name: Copy file with owner and permissions
copy:
src: "{{ playbook_dir }}/../../srv/myfiles/foo.conf"
dest: /etc/foo.conf
owner: foo
group: foo
mode: '0644'
- name: Template a file to /etc/file.conf
template:
src: "{{ playbook_dir }}/../../srv/mytemplates/foo.j2"
dest: /etc/file.conf
owner: bin
group: wheel
mode: '0644'
- name: Copy file with owner and permissions
copy:
src: /srv/myfiles/foo.conf
dest: /etc/foo.conf
owner: foo
group: foo
mode: '0644'
- name: Template a file to /etc/file.conf
template:
src: /mytemplates/foo.j2
dest: /etc/file.conf
owner: bin
group: wheel
mode: '0644'