ansible-role-files/tasks/file.yml
2019-06-18 01:55:25 +01:00

33 lines
704 B
YAML

- set_fact:
defaultfile:
group: root
owner: root
mode: "0700"
state: present
content: ~
template: ~
template_vars: {}
- set_fact:
file: "{{ defaultfile|combine(item.value|d({}), {'path': item.key} ) }}"
- name: create file/folder
when:
- not file.content
- not file.template
file:
path: "{{ file.path }}"
group: "{{ file.group }}"
owner: "{{ file.owner }}"
mode: "{{ file.mode }}"
state: "{{ file.state }}"
- name: create file/folder
when:
- file.content
copy:
dest: "{{ file.path }}"
group: "{{ file.group }}"
owner: "{{ file.owner }}"
mode: "{{ file.mode }}"
content: "{{ file.content }}"