zuul-jobs/roles/ensure-cabal/tasks/main.yaml
Ian Wienand 0d872a19b4 Ensure dnf-plugins-core before calling "dnf copr"
Technically dnf doesn't require dnf-plugins-core so it's possible "dnf
copr" may not work.  Our Fedora 34 images aren't pre-installing it
(something we should probably fix) but this should be fine as a
generic saftey bootstrap anyway.

Change-Id: I8a645f582f5955c93b4e115ad8bed7c46def5c82
2021-06-18 11:09:40 +10:00

37 lines
806 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
- 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
when: _cabal_version.rc != 0
- name: Check package
stat:
path: "~/.cabal/packages"
register: _cabal_packages
- name: Update package list
command: cabal update
when: not _cabal_packages.stat.exists