--- - name: check if selinux is enabled command: getenforce register: selinuxstatus changed_when: false failed_when: false check_mode: no - name: if selinux is not disable when: selinuxstatus.stdout != 'Disabled' 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 nfs-ganesha-selinux and python3-policycoreutils on RHEL 8 package: name: ['nfs-ganesha-selinux', 'python3-policycoreutils'] state: present register: result until: result is succeeded when: ansible_facts['distribution_major_version'] == '8' - name: add ganesha_t to permissive domain selinux_permissive: name: ganesha_t permissive: true failed_when: false