cleaned up role

This commit is contained in:
nd 2021-07-11 12:34:05 +02:00
parent b68cccbab5
commit 7be38f39ca
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
2 changed files with 16 additions and 27 deletions

View file

@ -1 +1,11 @@
files: {}
files_default:
group: root
owner: root
mode: "0700"
state: touch
src: ~
content: ~
template: ~
template_vars: {}

View file

@ -1,22 +1,10 @@
- set_fact:
defaultfile:
group: root
owner: root
mode: "0700"
state: touch
src: ~
content: ~
template: ~
template_vars: {}
file: "{{ {}|combine(files_default, item.value|d({}), {'path': item.key} ) }}"
- set_fact:
file: "{{ defaultfile|combine(item.value|d({}), {'path': item.key} ) }}"
- name: create file/folder
- name: "create file/folder (file module, {{ file.path }})"
when:
- not file.content
- not file.template
- not file.src
file:
path: "{{ file.path }}"
group: "{{ file.group }}"
@ -25,23 +13,14 @@
src: "{{ file.src }}"
state: "{{ file.state }}"
- name: create file/folder
- name: "create file/folder (copy module, {{ file.path }})"
when:
- file.content
- not file.src
- file.content or file.src
- file.state != 'link'
copy:
dest: "{{ file.path }}"
group: "{{ file.group }}"
owner: "{{ file.owner }}"
mode: "{{ file.mode }}"
content: "{{ file.content }}"
- name: create file/folder
when:
- file.src
copy:
dest: "{{ file.path }}"
group: "{{ file.group }}"
owner: "{{ file.owner }}"
mode: "{{ file.mode }}"
src: "{{ file.src }}"