b2020d5c10
With the more recent versions of ansible, we should now use "is" instead of the "|" sign for the tests. This should fix it. Change-Id: Ie89ff6580bec52b598776c479a909c9a99c005b0
61 lines
1.7 KiB
YAML
61 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_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-tools"
|
|
yum: "btrfs-progs"
|
|
zypper: "btrfsprogs"
|