From e3bff6c8c449992169078f3a06c193e9c6e47042 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 18 Nov 2024 15:15:49 +0100 Subject: [PATCH] fix(install): refine the decision-making for OSs Signed-off-by: Matej Focko --- roles/sshd/tasks/install.yml | 9 ++++----- roles/wg/tasks/install.yml | 27 +++++++++++++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/roles/sshd/tasks/install.yml b/roles/sshd/tasks/install.yml index 6d5c586..38b5bad 100644 --- a/roles/sshd/tasks/install.yml +++ b/roles/sshd/tasks/install.yml @@ -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" diff --git a/roles/wg/tasks/install.yml b/roles/wg/tasks/install.yml index 81c816d..9ae82f7 100644 --- a/roles/wg/tasks/install.yml +++ b/roles/wg/tasks/install.yml @@ -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"