Every role scenario with a converge now runs check right before it (a fresh host) and right after it (a configured host), and a script test fails a scenario without both. pihole and pve_lxc move their second check from after idempotence to after converge to match. The roles that failed under --check on a fresh host get the two allowed guards: cloudflared, docker, gitea, gitea_runner, traefik and user_management. ufw and fail2ban preview only a host where their package is installed, as their READMEs now say. Closes #134 Assisted-by: Claude Code
58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
---
|
|
- name: Create Traefik directories
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ traefik_dir }}"
|
|
state: directory
|
|
owner: "{{ traefik_user }}"
|
|
group: "{{ traefik_user }}"
|
|
mode: "0700" # "0755"
|
|
loop:
|
|
- "{{ traefik_config_dir }}"
|
|
- "{{ traefik_dynamic_dir }}"
|
|
- "{{ traefik_config_dir }}/logs"
|
|
loop_control:
|
|
loop_var: traefik_dir
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Ensure ACME file exists (without overwriting)
|
|
become: true
|
|
ansible.builtin.command:
|
|
cmd: touch {{ traefik_acme_file }}
|
|
args:
|
|
creates: "{{ traefik_acme_file }}"
|
|
register: __traefik_acme_touch
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Ensure correct permissions on ACME file
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ traefik_acme_file }}"
|
|
owner: "{{ traefik_user }}"
|
|
group: "{{ traefik_user }}"
|
|
mode: "0600"
|
|
# Under --check the touch above is skipped, and the file module fails on a missing file.
|
|
when: not ansible_check_mode or __traefik_acme_touch is not changed
|
|
tags: [traefik, install, binary, update]
|
|
|
|
- name: Install the Traefik binary
|
|
ansible.builtin.include_tasks: download.yml
|
|
vars:
|
|
traefik_download_dir: "{{ traefik_bin_path | dirname }}"
|
|
tags: [traefik, install, binary]
|
|
|
|
- name: Ensure Traefik binary exists
|
|
ansible.builtin.stat:
|
|
path: "{{ traefik_bin_path }}"
|
|
register: traefik_binary
|
|
tags: [traefik, install, binary, health, update]
|
|
|
|
- name: Fail if Traefik binary missing
|
|
ansible.builtin.assert:
|
|
that:
|
|
- traefik_binary.stat.exists
|
|
fail_msg: "Traefik binary not found after extraction"
|
|
# Nothing is extracted under --check.
|
|
when: not ansible_check_mode
|
|
tags: [traefik, install, binary, health, update]
|