Use generic package module with list of variables for different package names etc.
Assert supported OS (fast fail) at start of role / playbook
- name: Ensure target OS is Debian-based
ansible.builtin.assert:
that:
- ansible_facts['os_family'] == "Debian"
fail_msg: "This role only supports Debian-based operating systems."
success_msg: "OS verified as Debian-based."
Either add this task to the entrypoint playbook as a pre-task:
---- name:Configure Homelab Servershosts:allpre_tasks:- name:Ensure target OS is Debian-basedansible.builtin.assert:that:- ansible_facts['os_family'] == "Debian"fail_msg:"This playbook and its roles only support Debian-based operating systems."success_msg:"OS verified as Debian-based."roles:- studio.ansible.base- studio.ansible.docker- studio.ansible.backup
Make all roles dependent on base role with
---dependencies:- role:base
Or create a dedicated validation role like roles/validate_os which needs to run first in every playbook (either add to the README, or include it as a dependency in all roles)
Strategy for handling multi-OS environments:
1. Use generic `package` module with list of variables for different package names etc.
2. Assert supported OS (fast fail) at start of role / playbook
```
- name: Ensure target OS is Debian-based
ansible.builtin.assert:
that:
- ansible_facts['os_family'] == "Debian"
fail_msg: "This role only supports Debian-based operating systems."
success_msg: "OS verified as Debian-based."
```
Either add this task to the entrypoint playbook as a pre-task:
```yml
---
- name: Configure Homelab Servers
hosts: all
pre_tasks:
- name: Ensure target OS is Debian-based
ansible.builtin.assert:
that:
- ansible_facts['os_family'] == "Debian"
fail_msg: "This playbook and its roles only support Debian-based operating systems."
success_msg: "OS verified as Debian-based."
roles:
- studio.ansible.base
- studio.ansible.docker
- studio.ansible.backup
```
Make all roles dependent on `base` role with
```yml
---
dependencies:
- role: base
```
Or create a dedicated validation role like `roles/validate_os` which _needs_ to run first in every playbook (either add to the README, or include it as a dependency in all roles)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Strategy for handling multi-OS environments:
Use generic
packagemodule with list of variables for different package names etc.Assert supported OS (fast fail) at start of role / playbook
Either add this task to the entrypoint playbook as a pre-task:
Make all roles dependent on
baserole withOr create a dedicated validation role like
roles/validate_oswhich needs to run first in every playbook (either add to the README, or include it as a dependency in all roles)see #3