Replace systemd-mount template with role
To reduce role complexity we replace separatelly maintained template with systemd_mount role that is widely used across OSA. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/836945 Change-Id: I23632f9c145be334b1d19067352f8b82114a1209
This commit is contained in:
parent
ed38f3393d
commit
337ddf8780
@ -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
|
@ -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"
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user