d6f0630c8c
Change-Id: I5307fe00a8cf875b622f8b077242596648d52182
98 lines
2.5 KiB
YAML
98 lines
2.5 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
|
|
mode: "0755"
|
|
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.
|
|
- name: Verify LVM VG
|
|
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
|
|
|
|
- name: Including lxc_container_destroy tasks
|
|
include_tasks: lxc_container_destroy.yml
|
|
when:
|
|
- physical_host != inventory_hostname
|
|
- lxc_container_recreate | bool
|
|
|
|
- name: Including lxc_container_create tasks
|
|
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
|
|
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
|
|
meta: flush_handlers
|
|
|
|
- name: (RE)Gather facts post setup
|
|
setup:
|
|
gather_subset: "network,hardware,virtual"
|