Merge "Replace systemd-mount template with role"

This commit is contained in:
Zuul 2022-04-29 20:56:48 +00:00 committed by Gerrit Code Review
commit 4d4517f2af
3 changed files with 14 additions and 64 deletions

View File

@ -1,19 +0,0 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Virtual Machine and Container Storage
ConditionPathExists=/var/lib/machines.raw
[Mount]
What=/var/lib/machines.raw
Where=/var/lib/machines
Type=ext4
Options=loop,defaults,noatime,nodiratime
[Install]
WantedBy=multi-user.target

View File

@ -32,27 +32,6 @@
name: "systemd-importd.service"
state: "restarted"
- name: Enable machines mount
systemd:
daemon_reload: yes
name: "var-lib-machines.mount"
enabled: "yes"
listen: Start machines mount
# NOTE(cloudnull): The systemd module is not used to start the
# mount because we dont want to "restart" the
# mount unnecessarily. To ensure we're able to
# load new options without requiring a mount
# restart the systemctl command is used with
# the "reload-or-restart" argument.
- name: Start or reload the machines mount
command: "systemctl reload-or-restart var-lib-machines.mount"
args:
warn: no
listen: Start machines mount
tags:
- skip_ansible_lint
- name: Restart irqbalance
systemd:
name: "irqbalance"

View File

@ -26,30 +26,20 @@
when:
- machines_create is changed
- name: Create machines mount point
file:
path: "/var/lib/machines"
state: "directory"
recurse: true
- name: Move machines mount into place
copy:
src: var-lib-machines.mount
dest: /lib/systemd/system/var-lib-machines.mount
register: mount_unit
- name: Reload the System daemon
systemd:
daemon_reload: yes
when: mount_unit is changed
- name: Mount all
shell: "mount | grep '/var/lib/machines' || (systemctl start var-lib-machines.mount && exit 3)"
register: mount_machines
changed_when: mount_machines.rc == 3
failed_when: mount_machines.rc not in [0, 3]
tags:
- skip_ansible_lint
- 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: