mirror of
https://github.com/luzifer-ansible/simplefile.git
synced 2024-11-08 13:50:03 +00:00
49 lines
1.6 KiB
YAML
49 lines
1.6 KiB
YAML
---
|
|
|
|
- name: Create required directories
|
|
file:
|
|
dest: '{{ item.dest | dirname }}'
|
|
recurse: true
|
|
|
|
- name: Set permissions for directory
|
|
file:
|
|
dest: '{{ item.dest | dirname }}'
|
|
owner: '{{ item.owner | default(omit) }}'
|
|
group: '{{ item.group | default(omit) }}'
|
|
|
|
- name: Write file
|
|
copy:
|
|
attributes: '{{ item.attributes | default(omit) }}'
|
|
backup: '{{ item.backup | default(omit) }}'
|
|
content: '{{ item.content | default(omit) }}'
|
|
decrypt: '{{ item.decrypt | default(omit) }}'
|
|
dest: '{{ item.dest }}'
|
|
directory_mode: '{{ item.directory_mode | default(omit) }}'
|
|
follow: '{{ item.follow | default(omit) }}'
|
|
force: '{{ item.force | default(omit) }}'
|
|
group: '{{ item.group | default(omit) }}'
|
|
local_follow: '{{ item.local_follow | default(omit) }}'
|
|
mode: '{{ item.mode | default(omit) }}'
|
|
owner: '{{ item.owner | default(omit) }}'
|
|
remote_src: '{{ item.remote_src | default(omit) }}'
|
|
selevel: '{{ item.selevel | default(omit) }}'
|
|
serole: '{{ item.serole | default(omit) }}'
|
|
setype: '{{ item.setype | default(omit) }}'
|
|
seuser: '{{ item.seuser | default(omit) }}'
|
|
src: '{{ item.src | default(omit) }}'
|
|
unsafe_writes: '{{ item.unsafe_writes | default(omit) }}'
|
|
validate: '{{ item.validate | default(omit) }}'
|
|
register: simplefile_write_file
|
|
when: item.state is not defined or item.state != 'absent'
|
|
|
|
- name: Remove file
|
|
file:
|
|
dest: '{{ item.dest }}'
|
|
state: 'absent'
|
|
when: item.state is defined and item.state == 'absent'
|
|
|
|
- name: Execute post-command
|
|
command: '{{ item.post_command }}'
|
|
when: item.post_command is defined and simplefile_write_file.changed
|
|
|
|
...
|