summaryrefslogtreecommitdiffstats
path: root/ansible/roles/package-repository-check/tasks/RedHat.yml
blob: e841f172c87398f8fb60fd217c49f20734f37e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
- name: verify
  block:
    # Clean cache prior to refreshing
    - name: Clean yum cache
      command: yum clean all
      args:
        warn: false
    # Refresh cache to ensure repo is reachable
    - name: Update yum cache
      yum:
        update_cache: yes
        state: latest
      tags:
        - skip_ansible_lint  # Prevent '[403] Package installs should not use latest' ansible lint task rule
  rescue:
    - name: Fail if yum cache updating failed
      fail:
        msg: "Couldn't refresh yum cache, repositories not configured properly. Check ansible logs for details."
  become: true