openstack-ansible-lxc_hosts/tasks/lxc_install_yum.yml
Andy McCrae eee919ad21 Fix lxc_net configuration for CentOS/SUSE
For CentOS/Red Hat and SUSE the network post-up/post-down scripts are
configured after the bridge has been brought up, and the handlers have
been flushed.

We need to configure the post-up and post-down scripts before the
restart bridge handler is flushed, so that dnsmasq is configured and
running before we attempt to install packages into the container.

Change-Id: Ifdb52624ed792665c858b3cdd4eec4b6aa365b1e
2017-09-12 15:39:09 -06:00

79 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 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: 50
state: present
register: copr_repository_deploy
# NOTE: Existing CentOS environments may not have the COPR repo priority set
# higher than the default. The following task ensures that existing
# deployments have their priority adjusted for the COPR repository.
# TODO(mhayden): The ini_file module is required here since the yum_repository
# module can only do add/remove operations, not edits.
# Ansible bug: https://github.com/ansible/ansible/issues/22362
- name: Ensure COPR repository priority is set
ini_file:
dest: /etc/yum.repos.d/thm-lxc2.0.repo
section: thm-lxc2.0
option: priority
value: 50
when:
- not copr_repository_deploy | changed
- name: Add GPG key for COPR LXC repo
rpm_key:
key: "{{ lxc_centos_package_key }}"
state: present
register: add_keys
until: add_keys | 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|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