zuul-jobs/roles/ensure-cabal/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

38 lines
828 B
YAML

- name: Make sure the role is run on Fedora
fail:
msg: "This role supports Fedora only"
when: "ansible_distribution != 'Fedora'"
- name: Check cabal version
command: cabal --version
failed_when: false
register: _cabal_version
- name: Install cabal
when: _cabal_version.rc != 0
block:
- name: Ensure copr dnf plugin
package:
name: dnf-plugins-core
state: present
become: yes
- name: Install cabal copr
command: dnf copr enable -y petersen/cabal-install
become: true
- name: Install cabal
package:
name: cabal-install
state: present
become: true
- name: Check package
stat:
path: "~/.cabal/packages"
register: _cabal_packages
- name: Update package list
command: cabal update
when: not _cabal_packages.stat.exists