Files
homelab-ansible/homelab.yml
Damien c86df61152 Add host exclusion and improve UFW task reliability
Add `excluded` host group and skip offline hosts
Fix UFW service initialization command for Alpine Linux
2026-06-13 10:17:13 +02:00

32 lines
738 B
YAML

# yaml-language-server: $schema=https://raw.githubusercontent.com/ansible/ansible-lint/main/src/ansiblelint/schemas/playbook.json
---
- name: Homelab alignment
hosts: managed:!excluded
become: true
gather_facts: false
environment:
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
pre_tasks:
- name: Test connectivity
ansible.builtin.ping:
ignore_unreachable: true
register: ping_result
- name: Skip offline hosts
ansible.builtin.meta: end_host
when: ping_result.unreachable | default(false)
- name: Gather facts
ansible.builtin.setup:
roles:
- role: ufw
tags: ufw
- role: repos
tags: repos
- role: upgrade
tags: upgrade