bf9a79d05e
The machinectl default options, while functional, could be tuned for better overall performance. This change adds several options which will ensure container workloads are using the lest amount of storage with the best possible performance. For more information on the options being used see * https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#MOUNT_OPTIONS All of the "machines" mount procedures have been moved into a unified volume task file. This was done to ensure a consistent experience across our supported distros. To ensure any new options are non-disruptive, the mount handler has been changed to use "reload-or-restart" which will first try to reload a mount instead of restarting it mounts. Change-Id: Ia962fd4c5bb2a73ddd884d3bb3837c47b43d6903 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
76 lines
2.7 KiB
YAML
76 lines
2.7 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.
|
|
|
|
# In later versions of systemd this is not needed. Referenced in
|
|
# the following ML post resolves the bug.
|
|
# * https://lists.freedesktop.org/archives/systemd-devel/2015-March/029151.html
|
|
- name: Move machined service into place
|
|
template:
|
|
src: systemd-machined.service.j2
|
|
dest: /etc/systemd/system/systemd-machined.service
|
|
register: machined_unit
|
|
notify:
|
|
- Reload systemd units
|
|
- Restart machined
|
|
|
|
# In later versions of systemd this is not needed. Referenced in
|
|
# the following commit resolves the bug.
|
|
# * https://cgit.freedesktop.org/systemd/systemd/commit/src/machine/org.freedesktop.machine1.conf?id=72c3897f77a7352618ea76b880a6764f52d6327b
|
|
- name: Move machine1 dbus config into place
|
|
copy:
|
|
src: org.freedesktop.machine1.conf
|
|
dest: /etc/dbus-1/system.d/org.freedesktop.machine1.conf
|
|
register: machine1_conf
|
|
notify:
|
|
- Reload systemd units
|
|
- Restart dbus
|
|
|
|
# Ensure lxc networks are running as they're supposed to
|
|
- meta: flush_handlers
|
|
|
|
# Because of this post and it's related bug(s) this is adding the container
|
|
# volumes the old way. The new way would simply be calling `machinectl`.
|
|
# * https://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg28255.html
|
|
- name: Remove old image cache
|
|
command: "btrfs subvolume delete /var/lib/machines/{{ lxc_container_base_name }}"
|
|
register: cache_refresh_del
|
|
changed_when: cache_refresh_del.rc == 0
|
|
failed_when: cache_refresh_del.rc not in [0, 1]
|
|
when:
|
|
- lxc_image_cache_refresh | bool
|
|
|
|
- name: Add image cache
|
|
command: "btrfs subvolume create /var/lib/machines/{{ lxc_container_base_name }}"
|
|
register: cache_refresh_add
|
|
changed_when: cache_refresh_add.rc == 0
|
|
failed_when: cache_refresh_add.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: Place container rootfs
|
|
unarchive:
|
|
src: "/tmp/{{ cache_basename }}"
|
|
dest: "/var/lib/machines/{{ lxc_container_base_name }}"
|
|
remote_src: True
|
|
notify:
|
|
- Remove rootfs archive
|