openstack-ansible-lxc_conta.../tasks/main.yml
Jonathan Rosser 91b7997b34 Unify variables for all operating systems.
Refactoring of the lxc_hosts role means that there is no need for
differences in variables between operating systems.

This patch makes the ubuntu focal CI jobs non voting as it must
merge at the same time as a corresponding patch to lxc_hosts.

Change-Id: I29e91320baebb9a3a649533a0e1d3a433dd04ad9
2022-04-27 15:58:29 +00:00

85 lines
2.2 KiB
YAML

---
# 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
file:
path: /etc/ansible/facts.d/
state: directory
delegate_to: "{{ physical_host }}"
tags:
- always
- name: Check the physical_host variable is set
fail:
msg: "The physical_host variable is not defined."
when:
- physical_host is undefined
tags:
- always
- name: Read custom facts from previous runs
setup:
filter: ansible_local
delegate_to: "{{ physical_host }}"
tags:
- always
# NOTE(cloudnull): Check for the LXC volume group when creating LVM backed
# containers.
- block:
- name: Check for lxc volume group
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
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
- include_tasks: lxc_container_destroy.yml
when:
- physical_host != inventory_hostname
- lxc_container_recreate | bool
- include_tasks: lxc_container_create.yml
when:
- physical_host != inventory_hostname
tags:
- lxc-create
- include_tasks: lxc_container_config.yml
when:
- physical_host != inventory_hostname
tags:
- lxc-config
- name: Force all notified handlers now
meta: flush_handlers
- name: (RE)Gather facts post setup
setup:
gather_subset: "network,hardware,virtual"