06ac9563a4
All references to Gentoo, SUSE, Debian stretch and Centos-7 are removed. Conditional tasks, ternary operators and variables are simplified where possible OS specific variables files are generalised where possible Change-Id: I2defac928ff0081b262ba31bdb9981274f13b32b
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
---
|
|
# Copyright 2017, BBC R&D
|
|
#
|
|
# 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: Configure BTRFS backing storage
|
|
hosts: localhost
|
|
user: root
|
|
become: true
|
|
connection: local
|
|
tasks:
|
|
- block:
|
|
- name: Install BTRFS packages
|
|
package:
|
|
name: "{{ btrfs_package[ansible_facts['pkg_mgr'] | lower] }}"
|
|
state: present
|
|
|
|
- name: Create base directories
|
|
file:
|
|
path: "{{ item }}"
|
|
state: "directory"
|
|
with_items:
|
|
- /openstack
|
|
- /var/lib/lxc
|
|
|
|
- name: Create sparse lxc-btrfs file
|
|
command: "truncate -s 1024G /openstack/lxc-btrfs.img"
|
|
args:
|
|
creates: /openstack/lxc-btrfs.img
|
|
register: lxc_btrfs_create
|
|
|
|
- name: Format the lxc-btrfs file
|
|
filesystem:
|
|
fstype: btrfs
|
|
dev: /openstack/lxc-btrfs.img
|
|
when: lxc_btrfs_create is changed
|
|
|
|
- name: Create the mount points, fstab entries and mount the file systems
|
|
mount:
|
|
name: /var/lib/lxc
|
|
src: /openstack/lxc-btrfs.img
|
|
fstype: btrfs
|
|
state: mounted
|
|
when:
|
|
- lxc_container_backing_store == 'btrfs'
|
|
vars:
|
|
btrfs_package:
|
|
apt: "btrfs-progs"
|