--- - name: if selinux is not disabled when: ansible_facts['selinux']['status'] == 'enabled' block: - name: install policycoreutils-python 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 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'