
Change-Id: I12716f90baba344bc763c18bbdd2e4d2990cad19 Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
96 lines
2.7 KiB
YAML
96 lines
2.7 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: Ensure createrepo package is installed
|
|
ansible.builtin.dnf:
|
|
name: createrepo
|
|
state: present
|
|
|
|
- name: If a keyfile is provided, copy gpg keyfiles to the key location
|
|
ansible.builtin.copy:
|
|
src: "{{ item.keyfile }}"
|
|
dest: "{{ item.key }}"
|
|
mode: "0644"
|
|
loop: "{{ lxc_centos_repo_keys | selectattr('keyfile', 'defined') }}"
|
|
loop_control:
|
|
label: "{{ item.key }}"
|
|
|
|
- name: If key url is provideds, download gpg keyfiles to the key location
|
|
ansible.builtin.get_url:
|
|
url: "{{ item.url }}"
|
|
dest: "{{ item.key }}"
|
|
mode: "0640"
|
|
loop: "{{ lxc_centos_repo_keys | selectattr('url', 'defined') }}"
|
|
loop_control:
|
|
label: "{{ item.key }}"
|
|
register: _get_yum_keys
|
|
until: _get_yum_keys is success
|
|
retries: 5
|
|
delay: 2
|
|
|
|
- name: Install gpg keys
|
|
ansible.builtin.rpm_key:
|
|
key: "{{ item.key }}"
|
|
validate_certs: "{{ item.validate_certs | default(omit) }}"
|
|
state: "{{ item.state | default('present') }}"
|
|
loop: "{{ lxc_centos_repo_keys }}"
|
|
loop_control:
|
|
label: "{{ item.key }}"
|
|
|
|
- name: Install required repositories
|
|
ansible.builtin.yum_repository:
|
|
name: "{{ item.name }}"
|
|
baseurl: "{{ item.baseurl }}"
|
|
description: "{{ item.description | default(omit) }}"
|
|
gpgcheck: "{{ item.gpgcheck | default(omit) }}"
|
|
gpgkey: "{{ item.gpgkey }}"
|
|
enabled: "{{ item.enabled | default(true) }}"
|
|
state: "{{ item.state | default('present') }}"
|
|
includepkgs: "{{ item.includepkgs | default(omit) }}"
|
|
register: install_repo
|
|
until: install_repo is success
|
|
retries: 5
|
|
delay: 2
|
|
loop: "{{ lxc_centos_repos }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
|
|
- name: Install distro packages
|
|
ansible.builtin.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
|
|
ansible.builtin.file:
|
|
path: "/var/lock/subsys/lxc"
|
|
state: "absent"
|
|
owner: "root"
|
|
group: "root"
|
|
tags:
|
|
- lxc-directories
|
|
|
|
- name: Enable lxc service
|
|
ansible.builtin.service:
|
|
name: lxc
|
|
enabled: "yes"
|
|
tags:
|
|
- lxc_hosts-config
|