From: Oleg Broytman Date: Sun, 1 Sep 2019 15:19:40 +0000 (+0300) Subject: Feat: Recognize OS type by `os_family`, not OS name X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=d5ce40f24315402f3acd3e099cc48dc8f774d356;p=ansible.git 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... --- 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