Execution
Date 08 Dec 2025 13:40:18 +0000
Duration 00:10:06.79
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.12.11
Summary
15 Hosts
608 Tasks
2412 Results
18 Plays
158 Files
0 Records

File: /home/zuul/src/opendev.org/openstack/openstack-ansible-lxc_hosts/tasks/lxc_install_dnf.yml

---
# 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