Files
openstack-ansible-lxc_hosts/tasks/lxc_cache_preparation_systemd_new.yml
Kevin Carter f179f21a66 Clean-up old systemd prep and allow machinctl to grow
The machinectl cache is currently set image to 16G by default. If
multiple container images are imported into the cache this may be too
small by default. This change sets the cache to "64G" by default allowing
the cache more room to grow by.

This change also disables the quota system once the limit has been set
The option `lxc_host_machine_quota_disabled` has been added to disable or
enable the quota system as needed. This is done after the default limit has
been set so an adequately sized sparce file can be created should it not
already exist.

> More documentation can be seen here [0] with regard to the set-limit
  option.

Because we support both modern and older systemd, the cache prep tasks
for old systemd have been updated so that deployers using earlier
versions of systemd can benefit from the ability to grow an existing
cache via playbook run.

[0] https://www.freedesktop.org/software/systemd/man/machinectl.html#set-limit%20%5BNAME%5D%20BYTES

Closes-Bug: #1745361
Change-Id: I85fefc6ce186bb6808ac37a9ea79a50e29671115
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-02-12 15:30:14 +00:00

61 lines
1.9 KiB
YAML

---
# Copyright 2015, 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.
# NOTE(cloudnull): When modern SystemD is running everywhere this can be
# collapsed back into the base preparation task file.
- name: Set volume size
shell: machinectl set-limit {{ lxc_host_machine_volume_size }}
changed_when: false
args:
executable: /bin/bash
- name: Disable the machinectl quota system
command: "btrfs quota {{ lxc_host_machine_quota_disabled | bool | ternary('disable', 'enable') }} /var/lib/machines"
changed_when: false
- name: Remove old image cache
command: "machinectl remove {{ lxc_container_base_name }}"
register: cache_refresh
changed_when: cache_refresh.rc == 0
failed_when: cache_refresh.rc not in [0, 1]
when:
- lxc_image_cache_refresh | bool
- name: Ensure image has been pre-staged
async_status:
jid: "{{ prestage_image.ansible_job_id }}"
register: job_result
until: job_result.finished
retries: 60
- name: Retrieve base image
command: >-
machinectl
--verify=no
{{ lxc_image_cache_pull_mode }}
/tmp/rootfs.tar.xz
{{ lxc_container_base_name }}
register: pull_image
until: pull_image | success
retries: 3
delay: 1
changed_when: pull_image.rc == 0
failed_when:
- pull_image.rc != 0
- "'failed' in pull_image.stderr | lower"
with_items: "{{ lxc_images }}"
notify:
- Remove rootfs archive