- name: Make sure the role is run on Fedora fail: msg: "This role supports Fedora only" when: "ansible_distribution != 'Fedora'" - name: Check requested version fail: msg: | Unknown ghc version: {{ ghc_version }}. It needs to be defined in {{ opendev_url }}/roles/ensure-ghc/defaults/main.yaml when: ghc_versions[ghc_version] is not defined vars: opendev_url: https://opendev.org/zuul/zuul-jobs/src/branch/master/ - name: Check ghc version command: ghc --version failed_when: false register: _ghc_version - name: Install ghc dnf: name: "@ghc:{{ ghc_versions[ghc_version]|string }}" state: present become: yes when: "_ghc_version.rc != 0 or (ghc_versions[ghc_version]|string) not in _ghc_version.stdout"