a22ec2150f
These are leftover from when the role downloaded prebuilt LXC iamges, but are no longer used. Change-Id: I3689e18cbd62804d7a959beb8f58f91920beecd1
66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
---
|
|
# Copyright 2020, 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: Create sparse machines file
|
|
command: "truncate -s 11G /var/lib/machines.raw"
|
|
args:
|
|
creates: /var/lib/machines.raw
|
|
register: machines_create
|
|
|
|
- name: Format the machines file
|
|
filesystem:
|
|
fstype: ext4
|
|
dev: /var/lib/machines.raw
|
|
when:
|
|
- machines_create is changed
|
|
|
|
- name: Create systemd mount
|
|
import_role:
|
|
name: systemd_mount
|
|
vars:
|
|
systemd_mounts:
|
|
- what: '/var/lib/machines.raw'
|
|
where: '/var/lib/machines'
|
|
type: 'ext4'
|
|
options: 'loop'
|
|
unit:
|
|
ConditionPathExists:
|
|
- '/var/lib/machines.raw'
|
|
state: 'started'
|
|
enabled: true
|
|
|
|
- name: Remove the old image cache
|
|
file:
|
|
path: "/var/lib/machines/{{ lxc_container_base_name }}"
|
|
state: absent
|
|
when:
|
|
- lxc_image_cache_refresh | bool
|
|
|
|
- name: Create new image cache directory
|
|
file:
|
|
path: "/var/lib/machines/{{ lxc_container_base_name }}"
|
|
state: directory
|
|
mode: "0755"
|
|
register: create_new_dir
|
|
|
|
- name: Build the base image using a CLI tool
|
|
command: "{{ lxc_hosts_container_build_command }}"
|
|
when: lxc_hosts_container_build_command | length > 0
|
|
changed_when: false
|
|
register: _build_container_base_image
|
|
until: _build_container_base_image is success
|
|
retries: 5
|
|
delay: 2
|