Execution
Date 05 Dec 2025 13:22:31 +0000
Duration 00:00:50.80
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.12.11
Summary
2 Hosts
72 Tasks
71 Results
7 Plays
97 Files
0 Records

File: /home/zuul/src/opendev.org/openstack/openstack-ansible-lxc_container_create/tasks/main.yml

---
# Copyright 2014, 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: Allow the usage of local facts
  ansible.builtin.file:
    path: /etc/ansible/facts.d/
    state: directory
    mode: "0755"
  delegate_to: "{{ physical_host }}"
  tags:
    - always

- name: Check the physical_host variable is set
  ansible.builtin.fail:
    msg: "The physical_host variable is not defined."
  when:
    - physical_host is undefined
  tags:
    - always

- name: Read custom facts from previous runs
  ansible.builtin.setup:
    filter: ansible_local
  delegate_to: "{{ physical_host }}"
  tags:
    - always

# NOTE(cloudnull): Check for the LXC volume group when creating LVM backed
#                  containers.
- name: Verify LVM VG
  block:
    - name: Check for lxc volume group
      ansible.builtin.shell: "(which vgs > /dev/null && vgs | grep -o '{{ lxc_container_vg_name }}') || false"
      register: vg_result
      failed_when: false
      changed_when: vg_result.rc != 0
      delegate_to: "{{ physical_host }}"
    - name: LXC VG check
      ansible.builtin.fail:
        msg: >-
          The "lxc_container_backing_store" option was set to "lvm" but no LXC
          volume group was found on the physical host. Please check your settings
          and host setup.
      when:
        - vg_result.rc != 0
  when:
    - lxc_container_backing_store == 'lvm'
  tags:
    - always

- name: Including lxc_container_destroy tasks
  ansible.builtin.include_tasks: lxc_container_destroy.yml
  when:
    - physical_host != inventory_hostname
    - lxc_container_recreate | bool

- name: Including lxc_container_create tasks
  ansible.builtin.include_tasks: lxc_container_create.yml
  args:
    apply:
      tags:
        - lxc-create
  when:
    - physical_host != inventory_hostname
  tags:
    - lxc-create

- name: Including lxc_container_config tasks
  ansible.builtin.include_tasks: lxc_container_config.yml
  args:
    apply:
      tags:
        - lxc-config
  when:
    - physical_host != inventory_hostname
  tags:
    - lxc-config

- name: Force all notified handlers now
  ansible.builtin.meta: flush_handlers

- name: (RE)Gather facts post setup
  ansible.builtin.setup:
    gather_subset: "network,hardware,virtual"