zuul-jobs/roles/ensure-ghc/tasks/main.yaml
Ian Wienand f76cfbab11 linters: fix spaces between filters
This fixes a number of places where we do not have spaces between
filters.  I think that this is a reasonable rule for readability (I
also think it probably was enforced, but maybe later versions got
better at detecting it?).

These are detected by a later version of Ansible lint; this change
should have no operational change to any roles but prepares us to
update in a follow-on change.

Change-Id: I07e1a109b87adce86f483d14d7e02fcecb8313d5
2022-07-27 17:13:39 +10:00

26 lines
764 B
YAML

- 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"