refactor: hoist OS-specific package names to role defaults

- nfs_server: nfs_package_name (nfs-utils / nfs-kernel-server)
- wireguard: wireguard_package_name (wireguard-tools / wireguard)
- tooling:   tooling_dig_package, tooling_netcat_package

Also fix tooling role structure: move tooling.yml to tasks/main.yml so
the role is actually invokable via 'role: tooling' (defaults/main.yml
is auto-loaded), and collapse the 10 individual package tasks into a
single list-based install.
This commit is contained in:
Clément Désiles
2026-05-30 21:57:20 +02:00
parent a6ca97ca0e
commit b0324cf3fe
7 changed files with 31 additions and 62 deletions
+4
View File
@@ -16,3 +16,7 @@ nfs_port: 2049
nfs_server_firewall_allowed_sources: nfs_server_firewall_allowed_sources:
- 127.0.0.0/8 - 127.0.0.0/8
# OS-dependent package name
nfs_package_name: >-
{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('nfs-utils', 'nfs-kernel-server') }}
+1 -1
View File
@@ -1,7 +1,7 @@
--- ---
- name: Install nfs-server - name: Install nfs-server
ansible.builtin.package: ansible.builtin.package:
name: "{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('nfs-utils', 'nfs-kernel-server') }}" name: "{{ nfs_package_name }}"
state: present state: present
- name: Configure nfs configuration - name: Configure nfs configuration
+6
View File
@@ -0,0 +1,6 @@
---
# OS-dependent package names
tooling_dig_package: >-
{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('bind', 'dnsutils') }}
tooling_netcat_package: >-
{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('openbsd-netcat', 'netcat-openbsd') }}
+15
View File
@@ -0,0 +1,15 @@
---
- name: Install command-line tooling
ansible.builtin.package:
name:
- usbutils
- htop
- bottom
- wget
- ethtool
- iperf3
- vim
- nano
- "{{ tooling_dig_package }}"
- "{{ tooling_netcat_package }}"
state: present
-60
View File
@@ -1,60 +0,0 @@
---
- name: Install usbutils
package:
name: usbutils
state: present
changed_when: false
- name: Install htop
package:
name: htop
state: present
changed_when: false
- name: Install bottom
package:
name: bottom
state: present
changed_when: false
- name: Install wget
package:
name: wget
state: present
changed_when: false
- name: Install dig utility
package:
name: "{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('bind', 'dnsutils') }}"
state: present
changed_when: false
- name: Install ethtool
package:
name: ethtool
state: present
changed_when: false
- name: Install iperf3
package:
name: iperf3
state: present
changed_when: false
- name: Install vim
package:
name: vim
state: present
changed_when: false
- name: Install nano
package:
name: nano
state: present
changed_when: false
- name: Install netcat
package:
name: "{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('openbsd-netcat', 'netcat-openbsd') }}"
state: present
changed_when: false
+4
View File
@@ -15,3 +15,7 @@ wireguard_config_base_path: /etc/wireguard
# endpoint: host:port # optional: peer's public endpoint # endpoint: host:port # optional: peer's public endpoint
# persistent_keepalive: 25 # optional: keepalive interval (seconds) # persistent_keepalive: 25 # optional: keepalive interval (seconds)
wireguard_tunnels: [] wireguard_tunnels: []
# OS-dependent package name
wireguard_package_name: >-
{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('wireguard-tools', 'wireguard') }}
+1 -1
View File
@@ -11,7 +11,7 @@
- name: Install wireguard - name: Install wireguard
ansible.builtin.package: ansible.builtin.package:
name: "{{ (ansible_facts['os_family'] == 'Archlinux') | ternary('wireguard-tools', 'wireguard') }}" name: "{{ wireguard_package_name }}"
state: present state: present
# Use systemd-resolved for DNS management (modern approach on all distributions) # Use systemd-resolved for DNS management (modern approach on all distributions)