73 lines
1.8 KiB
YAML
73 lines
1.8 KiB
YAML
---
|
|
|
|
- name: Remove nginx, avoids port 80 conflict
|
|
ansible.builtin.apt:
|
|
name: nginx
|
|
state: absent
|
|
|
|
- name: Create authelia directories
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0750"
|
|
loop:
|
|
- "{{ authelia_base_dir }}"
|
|
- "{{ authelia_config_dir }}"
|
|
- "{{ authelia_data_dir }}"
|
|
|
|
- name: Check if Caddyfile path is wrongly a directory
|
|
ansible.builtin.stat:
|
|
path: "{{ authelia_base_dir }}/Caddyfile"
|
|
register: caddyfile_stat
|
|
|
|
- name: Remove Caddyfile if it was created as a directory
|
|
ansible.builtin.file:
|
|
path: "{{ authelia_base_dir }}/Caddyfile"
|
|
state: absent
|
|
when: caddyfile_stat.stat.exists and caddyfile_stat.stat.isdir
|
|
|
|
- name: Deploy Caddyfile
|
|
ansible.builtin.template:
|
|
src: Caddyfile.j2
|
|
dest: "{{ authelia_base_dir }}/Caddyfile"
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
notify: restart authelia
|
|
|
|
- name: Deploy configuration.yml
|
|
ansible.builtin.template:
|
|
src: configuration.yml.j2
|
|
dest: "{{ authelia_config_dir }}/configuration.yml"
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
notify: restart authelia
|
|
|
|
- name: Deploy users_database.yml
|
|
ansible.builtin.template:
|
|
src: users_database.yml.j2
|
|
dest: "{{ authelia_config_dir }}/users_database.yml"
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
notify: restart authelia
|
|
when: authelia_users is defined
|
|
|
|
- name: Deploy docker-compose.yml
|
|
ansible.builtin.template:
|
|
src: docker-compose.yml.j2
|
|
dest: "{{ authelia_base_dir }}/docker-compose.yml"
|
|
owner: root
|
|
group: root
|
|
mode: "0640"
|
|
register: compose_file
|
|
|
|
- name: Pull and start authelia via docker compose
|
|
community.docker.docker_compose_v2:
|
|
project_src: "{{ authelia_base_dir }}"
|
|
state: present
|
|
pull: missing
|