--- - block: - name: install mandatory selinux packages package: name: policycoreutils-python state: installed when: ansible_distribution_major_version|int < 8 - block: - name: install mandatory selinux packages package: name: policycoreutils-python-utils state: installed when: ansible_distribution_major_version|int >= 8 - name: create selinux module directory file: dest: /usr/local/share/selinux state: directory mode: 0755 owner: root group: "{{ ansible_wheel }}"