--- - name: If selinux is not disabled when: ansible_facts['selinux']['status'] == 'enabled' block: - name: Install policycoreutils-python ansible.builtin.package: name: policycoreutils-python state: present register: result until: result is succeeded when: ansible_facts['distribution_major_version'] == '7' - name: Install python3-policycoreutils on RHEL 8 ansible.builtin.package: name: python3-policycoreutils state: present register: result until: result is succeeded when: - inventory_hostname in groups.get(nfs_group_name, []) or inventory_hostname in groups.get(rgwloadbalancer_group_name, []) - ansible_facts['distribution_major_version'] == '8'