openstack-ansible-lxc_hosts/tasks/lxc_install_yum.yml
Mohammed Naser 52674aab6c lxc: stop mirroring COPR locally on CentOS 7
We no longer need to mirror this locally all the time on all the
machines which includes downloading way too many packages than we
need.

We have mirorring and proxies in place in upstream to avoid these
issues and if we have any problems, we can resort to adding mirrors
or proxies in infra.

If there is network problems with these repositories, they will still
hit us if we're mirroring things.

Change-Id: Idad048de6aef569e0e3b73b09448750cf0a06b16
2018-11-07 11:14:59 +01:00

86 lines
2.3 KiB
YAML

---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Deploy upstream COPR yum repo for LXC 2.0
yum_repository:
name: thm-lxc2.0
description: "COPR repository for LXC 2.0 packages on CentOS 7"
baseurl: "{{ lxc_centos_package_baseurl }}"
enabled: yes
gpgcheck: yes
gpgkey: "{{ lxc_centos_package_key }}"
repo_gpgcheck: no
priority: 99
state: present
- name: Add GPG key for COPR LXC repo
rpm_key:
key: "{{ lxc_centos_package_key }}"
state: present
register: add_keys
until: add_keys is success
retries: 5
delay: 2
- name: Install EPEL gpg keys
rpm_key:
key: "http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7"
state: present
register: _add_yum_keys
until: _add_yum_keys is success
retries: 5
delay: 2
- name: Install the EPEL repository
yum_repository:
name: epel-lxc_hosts
baseurl: "{{ (centos_epel_mirror | default ('http://download.fedoraproject.org/pub/epel')) ~ '/' ~ ansible_distribution_major_version ~ '/' ~ ansible_architecture }}"
description: 'Extra Packages for Enterprise Linux 7 - $basearch'
gpgcheck: yes
enabled: yes
state: present
includepkgs: 'aria2 python2-lxc'
register: install_epel_repo
until: install_epel_repo is success
retries: 5
delay: 2
- name: Install distro packages
package:
pkg: "{{ lxc_hosts_distro_packages }}"
state: "{{ lxc_hosts_package_state }}"
register: install_packages
until: install_packages is success
retries: 5
delay: 2
tags:
- lxc-packages
- name: Remove sub system lock if found
file:
path: "/var/lock/subsys/lxc"
state: "absent"
owner: "root"
group: "root"
tags:
- lxc-directories
- name: Enable lxc service
service:
name: lxc
enabled: "yes"
tags:
- lxc_hosts-config