--- - name: Install required dependency libsemanage-python become: true yum: name: libsemanage-python state: present when: (ansible_distribution_major_version is version('7', '=')) - name: Install required dependency python3-policycoreutils become: true dnf: name: python3-policycoreutils state: present when: (ansible_distribution_major_version is version('8', '>='))