From d5ce40f24315402f3acd3e099cc48dc8f774d356 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 1 Sep 2019 18:19:40 +0300 Subject: [PATCH] Feat: Recognize OS type by `os_family`, not OS name There are too many OS names to recognize: Debian, (K/X)Ubuntu, CentOS, Fedora, RedHat... --- playbooks/roles/adjtimex/tasks/main.yml | 4 ++-- playbooks/roles/sshd/handlers/main.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/adjtimex/tasks/main.yml b/playbooks/roles/adjtimex/tasks/main.yml index 16209b7..a7864a8 100644 --- a/playbooks/roles/adjtimex/tasks/main.yml +++ b/playbooks/roles/adjtimex/tasks/main.yml @@ -8,7 +8,7 @@ name: ['adjtimex', 'ntpdate-debian'] state: latest update_cache: yes - when: ansible_facts.distribution == "Debian" + when: ansible_facts.os_family == 'Debian' - name: Install adjtimex and ntpdate become: true @@ -16,7 +16,7 @@ name: ['adjtimex', 'ntpdate'] state: latest update_cache: yes - when: ansible_facts.distribution != "Debian" + when: ansible_facts.os_family == 'RedHat' - name: Copy the script adjtimex.sh become: true diff --git a/playbooks/roles/sshd/handlers/main.yml b/playbooks/roles/sshd/handlers/main.yml index 264fd31..b7beb0a 100644 --- a/playbooks/roles/sshd/handlers/main.yml +++ b/playbooks/roles/sshd/handlers/main.yml @@ -1,5 +1,5 @@ - name: Reload sshd become: true service: - name: "ssh{{ ansible_facts.distribution != 'Debian' and 'd' or '' }}" + name: "ssh{{ ansible_facts.os_family == 'RedHat' and 'd' or '' }}" state: reloaded -- 2.39.5