zuul-jobs/roles/ensure-haskell-stack/tasks/main.yaml
Ian Wienand 8c6512107c
Standarise block/when ordering
Newer ansbile-lint finds "when" or "become" statements that are at the
end of blocks.  Ordering these before the block seems like a very
logical thing to do, as we read from top-to-bottom so it's good to see
if the block will execute or not.

This is a no-op, and just moves the places the newer linter found.

Change-Id: If4d1dc4343ea2575c64510e1829c3fe02d6c273f
2022-11-07 10:37:53 +11:00

35 lines
885 B
YAML

- name: Make sure the role is run on Fedora
fail:
msg: "This role supports Fedora only"
when: "ansible_distribution != 'Fedora'"
- name: Check stack version
command: stack --version
failed_when: false
register: _stack_version
- name: Install stack
when: _stack_version.rc != 0
block:
# This package is somehow missing from the requirements of the
# published packaged copr repo. See
# https://github.com/commercialhaskell/stack/issues/5388
- name: Preinstall gmp-devel
package:
name: gmp-devel
state: present
become: true
- name: Install stack
package:
name: stack
state: present
become: true
- name: Upgrade stack
command: stack upgrade
become: true
- name: Setup stack LTS
command: "stack {% if lts_version %}--resolver {{ lts_version }}{% endif %} setup"