diff --git a/roles/extra_packages/tasks/main.yml b/roles/extra_packages/tasks/main.yml
index 89b03b15efd4a62544bf6c8f7a58ae6ed895efdc..309dd0b884aa47ee3975e897a3fe2b423f9bb703 100644
--- a/roles/extra_packages/tasks/main.yml
+++ b/roles/extra_packages/tasks/main.yml
@@ -39,7 +39,8 @@
   with_items: "{{ extra_packages }}"
   become: true
   become_user: root
-  when: ansible_os_family == 'RedHat' 
+  when:
+   - '"CentOS" in ansible_distribution'
   register: result
 
 - name: "Install extra packages from epel only"
@@ -47,7 +48,8 @@
   with_items: "{{ extra_packages_epel }}"
   become: true
   become_user: root
-  when: ansible_os_family == 'RedHat'
+  when:
+   - '"CentOS" in ansible_distribution'
 
 - name: "Show yum install output"
   debug: