summaryrefslogtreecommitdiffstats
path: root/roles/openshift_repos/tasks/rhel_repos.yml
blob: 8d16629cc28ea85918ae2dd2f48345ad813eeb42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
- name: Ensure RHEL rhui repositories are disabled
  command: bash -c "yum -q --noplugins repolist | grep -v 'repo id' | grep 'rhui'"
  register: repo_rhui
  changed_when: "repo_rhui.rc != 1"
  failed_when: repo_rhui.rc == 11

- name: Disable RHEL rhui repositories
  command: yum-config-manager \
    --disable 'rhui-REGION-client-config-server-7' \
    --disable 'rhui-REGION-rhel-server-rh-common' \
    --disable 'rhui-REGION-rhel-server-releases'
  when: repo_rhui.changed

- name: Ensure RHEL repositories are enabled
  command: bash -c "yum -q --noplugins repolist | grep -v 'repo id' | grep 'Red Hat' | wc -l"
  register: repo_rhel
  changed_when: "'4' not in repo_rhel.stdout"
  failed_when: repo_rhel.rc == 11

- name: Disable all repositories
  command: bash -c "subscription-manager repos --disable='*'"
  when: repo_rhel.changed

- name: Enable RHEL repositories
  command: subscription-manager repos \
               --enable="rhel-7-server-rpms" \
               --enable="rhel-7-server-extras-rpms" \
               --enable="rhel-7-server-ose-{{ (openshift_release | default('')).split('.')[0:2] | join('.') }}-rpms" \
               --enable="rhel-7-fast-datapath-rpms"
  register: subscribe_repos
  until: subscribe_repos | succeeded
  when: repo_rhel.changed