Add mount state rescue block
The mount state could be volitile making it so the "restart-or-reload" option fails to execute. If this happens the task will now be rescued and the mount state will be attempted using the regular systemd module. Change-Id: I86fc03ad7c72fa4cfdfc598f552f936dda653926 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
e62715f740
commit
29412148c3
@ -66,7 +66,12 @@
|
||||
# requiring a mount restart the systemctl
|
||||
# command is used with the "reload-or-restart"
|
||||
# argument. Additionally this command escapes
|
||||
# the name of the mount.
|
||||
# the name of the mount. If this command fails
|
||||
# the task will be rescued and the regular
|
||||
# systemd module will be attempted before
|
||||
# failing the task run.
|
||||
- name: Mount state block
|
||||
block:
|
||||
- name: Set the state of the mount
|
||||
shell: >-
|
||||
systemctl
|
||||
@ -78,6 +83,11 @@
|
||||
- item.state is defined
|
||||
tags:
|
||||
- skip_ansible_lint
|
||||
rescue:
|
||||
- name: Set the state of the mount (fallback)
|
||||
systemd:
|
||||
name: "{{ mount_service_name.stdout }}"
|
||||
state: "{{ item.state }}"
|
||||
|
||||
- name: Unload mount(s)
|
||||
systemd:
|
||||
|
Loading…
x
Reference in New Issue
Block a user