fix(install): refine the decision-making for OSs

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-11-18 15:15:49 +01:00
parent c5747f422a
commit e3bff6c8c4
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8
2 changed files with 23 additions and 13 deletions

View file

@ -1,15 +1,14 @@
---
- name: SSH family packages for co-Ubuntu
- name: Set default family of packages for SSH
ansible.builtin.set_fact:
ssh_packages: [openssh, openssh-clients, openssh-server]
when: ansible_distribution not in ("Ubuntu", "Archlinux")
- name: SSH family packages for Ubuntu
- name: Set family of packages for SSH on Debian-based OSs
ansible.builtin.set_fact:
ssh_packages: [openssh-client, openssh-server]
when: ansible_distribution == "Ubuntu"
when: ansible_distribution in [ "Debian", "Ubuntu" ]
- name: SSH family package for archLinux
- name: Set family of packages for SSH on archLinux
ansible.builtin.set_fact:
ssh_packages: [openssh]
when: ansible_distribution == "Archlinux"

View file

@ -1,12 +1,23 @@
---
- name: Install the wireguard on Ubuntu
ansible.builtin.package:
name: wireguard
state: present
when: ansible_distribution == "Ubuntu"
- name: Set default packages for wireguard
ansible.builtin.set_fact:
wg_packages:
- wireguard-tools
- name: Install the wireguard on co-Ubuntu
- name: Set packages for wireguard on Debian-based OSs
ansible.builtin.set_fact:
wg_packages:
- wireguard
when: ansible_distribution in [ "Debian", "Ubuntu" ]
- name: Set packages for wireguard on archLinux
ansible.builtin.set_fact:
wg_packages:
- wireguard
- systemd-resolveconf
when: ansible_distribution == "Archlinux"
- name: Install wireguard and dependencies
ansible.builtin.package:
name: wireguard-tools
name: "{{ wg_packages }}"
state: present
when: ansible_distribution != "Ubuntu"