68e382ba2c
Since overlayfs is now part of the mainstream kernel, it makes sense to take advantage of it to speed up the container creation process. This patch implements the ability to set 'overlayfs' as the backing store for containers. This is an optional feature which must explicitly be set by the deployer. As this only works with Ansible > 2.0 a pre-requisite check has been implemented to protect against its use with prior versions. The inventory and key prep playbook have been adjusted to work with Ansible versions <2 and >2. The logging for the veth cleanup has been removed as overlayfs containers do not have access to the /dev/log device. This causes the container setup to be incomplete. Depends-On: I20123b83af10c0890f4d5945b9fb230acd664213 Change-Id: If5b11ef6d94fe863a75efd174957ad43b9d2e030
50 lines
2.0 KiB
YAML
50 lines
2.0 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: Ansible version and LXC backing store check
|
|
fail:
|
|
msg: "Using overlayfs is not supported when using Ansible version < 2"
|
|
when:
|
|
- lxc_container_backing_store is defined
|
|
- lxc_container_backing_store == "overlayfs"
|
|
- ansible_version.major < 2
|
|
|
|
- name: Kernel version and LXC backing store check
|
|
debug:
|
|
msg: "Using overlayfs is not recommended when using Kernel version < 3.18"
|
|
when:
|
|
- lxc_container_backing_store is defined
|
|
- lxc_container_backing_store == "overlayfs"
|
|
- hostvars[physical_host]['ansible_kernel'] | version_compare('3.18.0-0-generic', '<')
|
|
|
|
- name: Gather variables for each operating system
|
|
include_vars: "{{ item }}"
|
|
with_first_found:
|
|
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_version'] | lower }}.yml"
|
|
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_major_version'] | lower }}.yml"
|
|
- "{{ hostvars[physical_host]['ansible_os_family'] | lower }}-{{ hostvars[physical_host]['ansible_distribution_major_version'] | lower }}.yml"
|
|
- "{{ hostvars[physical_host]['ansible_distribution'] | lower }}.yml"
|
|
- "{{ hostvars[physical_host]['ansible_os_family'] | lower }}.yml"
|
|
tags:
|
|
- always
|
|
|
|
- include: container_create.yml
|
|
when:
|
|
- physical_host is defined
|
|
- inventory_hostname is defined
|
|
- physical_host != inventory_hostname
|
|
tags:
|
|
- lxc-container
|