integration-playbook: Require RHEL repos.

Both the base and extras repos are required.  Rather than try to fuss
around with subscription manager, require two variables be defined
pointing to the baseurl's to use.  Assert that these variables are set
and non-empty.

Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
Chris Evich 2017-09-20 17:23:56 -04:00
parent 78c400ccd3
commit bedf75dcfc

View file

@ -1,6 +1,8 @@
## This playbook expects --extra-vars "commit=<commit>"
## and either --extra-vars "pullrequest=<PR #>" or
## --skip-tags pr
## --skip-tags pr.
##
## Required: --extra-vars extras_repo_baseurl=<HTTP or HTTPS>
- hosts: all
remote_user: root
gather_facts: False # Ansible dependencies need installing first
@ -9,7 +11,11 @@
cni_commit: dcf7368eeab15e2affc6256f0bb1e84dd46a34de
integration_timeout_seconds: "{{ 60 * 60 * 2 }}"
pre_tasks:
# Assumes subscription stuff won't get in the way
# Assert subscription stuff won't get in the way
- assert:
that:
- 'extras_repo_baseurl | default(False)'
- 'server_repo_baseurl | default(False)'
- name: Install pre-requesites for ansible on all platforms
raw: $(type -P dnf || type -P yum) install -y python libselinux-python yum-utils python3-pycurl
# Gather facts
@ -25,6 +31,7 @@
description: "Extra Packages for Enterprise Linux"
baseurl: "http://dl.fedoraproject.org/pub/epel/7/$basearch"
metalink: "https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch"
enabled: True
gpgcheck: True
gpgcakey: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7Server"
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS')
@ -35,6 +42,26 @@
- https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
- https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS')
- name: Enable required RHEL repositories
yum_repository:
name: "{{ item.key }}"
description: Required repo. for RHEL
baseurl: "{{ item.value }}"
gpgcheck: False
enabled: True
with_dict:
extras: '{{ extras_repo_baseurl | mandatory }}'
server: '{{ server_repo_baseurl | mandatory }}'
when: (ansible_distribution == 'RedHat')
- name: Don't let old cache interfere with new efforts
shell: $(type -P dnf || type -P yum) clean all && rm -rf /var/cache/{yum,dnf}
- name: disable redhat yum plugin
ini_file:
path: "/etc/yum/pluginconf.d/subscription-manager.conf"
section: main
option: enabled
value: 0
when: (ansible_distribution == 'RedHat')
- name: Update all packages
yum:
name: '*'