matrix/roles/cinny/tasks/configure.yml

38 lines
1.3 KiB
YAML

---
- name: Ensure cinny user '{{ cinny_user }}' is {{ cinny_state }}
ansible.builtin.user:
name: "{{ cinny_user }}"
system: "{{ cinny_user_system | default(true, true) }}"
create_home: "{{ cinny_user_create_home | default(false, true) }}"
state: "{{ cinny_state }}"
groups: "{{ cinny_user_groups | default(omit) }}"
append: "{{ cinny_user_groups_append | default(omit) }}"
register: cinny_user_info
- name: Ensure host path are {{ cinny_state }}
ansible.builtin.file:
name: "{{ path.name }}"
state: "{{ (cinny_state == 'present') | ternary('directory', 'absent') }}"
owner: "{{ path.owner | default(cinny_host_uid) }}"
group: "{{ path.group | default(cinny_host_gid) }}"
mode: "{{ path.mode | default('0750') }}"
loop_control:
loop_var: path
label: "{{ path.name }}"
loop:
- name: "{{ cinny_base_path }}"
mode: '0755'
- name: "{{ cinny_config_path }}"
mode: '0755'
- name: "{{ cinny_source_path }}"
mode: '0755'
- name: Ensure config file is {{ cinny_state }}
ansible.builtin.copy:
content: "{{ cinny_config_complete | to_nice_json }}"
dest: "{{ cinny_config_file }}"
owner: "{{ cinny_host_uid }}"
group: "{{ cinny_host_gid }}"
mode: "{{ cinny_config_file_mode | default('0664') }}"
when: cinny_state == 'present'