ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit 078a847cf65271f9f3eab9881df359d37f3ed838
parent cd76a6fbf65d04a11ff433df8fd0f95523779cff
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 28 Jan 2021 23:31:05 +0100

files: new role
1 file changed, 39 insertions(+), 0 deletions(-)
A
roles/files/tasks/main.yml
|
39
+++++++++++++++++++++++++++++++++++++++
diff --git a/roles/files/tasks/main.yml b/roles/files/tasks/main.yml
@@ -0,0 +1,39 @@
+---
+
+- name: "[Files] Create defined directorys"
+  file:
+    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)"
+  file:
+    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"
+  file:
+    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
+