You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/_deploy/tasks/caddy_landing_page.yml

56 lines
1.7 KiB
YAML

---
- name: "Check if landing page service table exists"
stat:
path: "{{ caddy_landing_page_service_table_file_path_full }}"
register: check_caddy_landing_page_service_table_file
tags:
- update_deployment
- name: "Read landing page service table data"
slurp:
src: "{{ caddy_landing_page_service_table_file_path_full }}"
register: landing_page_service_table_plain
when: check_caddy_landing_page_service_table_file.stat.exists
tags:
- update_deployment
- name: "Set landing page service table as variable"
set_fact:
landing_page_service_table: "{{ landing_page_service_table_plain['content'] | b64decode }}"
when: check_caddy_landing_page_service_table_file.stat.exists
tags:
- update_deployment
- name: "Read landing page service table data"
set_fact:
landing_page_service_table: []
when: not check_caddy_landing_page_service_table_file.stat.exists
tags:
- update_deployment
- name: "Update landing page service table variable"
set_fact:
landing_page_service_table: "{{ ([item] + landing_page_service_table) | unique(attribute='current_name') }}"
with_items: "{{ current_services }}"
tags:
- update_deployment
- name: 'Ensures {{ caddy_landing_page_service_table_folder_path_full }} directory exists'
file:
state: directory
path: '{{ caddy_landing_page_service_table_folder_path_full }}'
tags:
- update_deployment
- update_config
- name: "Write landing page service table"
copy:
content: "{{ landing_page_service_table | to_nice_json }}"
dest: "{{ caddy_landing_page_service_table_file_path_full }}"
owner: "{{ docker_owner }}"
group: "{{ docker_group }}"
mode: 0644
tags:
- update_deployment