1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- name: "[Files] Create defined directorys"
file:
state: "directory"
dest: "{{ item.key }}"
mode: "{{ item.value.mode }}"
owner: "{{ item.value.owner }}"
group: "{{ item.value.group }}"
loop: "{{ lookup('dict', files, wantlist=True) }}"
when:
- files is defined
- item.value.state == "directory"
- name: "[Files] Create defined files (with content)"
copy:
dest: "{{ item.key }}"
mode: "{{ item.value.mode }}"
owner: "{{ item.value.owner }}"
group: "{{ item.value.group }}"
content: "{{ item.value.content }}"
loop: "{{ lookup('dict', files, wantlist=True) }}"
when:
- files is defined
- item.value.state == "file"
- item.value.content is defined
- name: "[Files] Create defined files"
copy:
dest: "{{ item.key }}"
mode: "{{ item.value.mode }}"
owner: "{{ item.value.owner }}"
group: "{{ item.value.group }}"
src: "{{ item.value.src }}"
loop: "{{ lookup('dict', files, wantlist=True) }}"
when:
- files is defined
- item.value.state == "file"
- item.value.src is defined