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,18 +66,28 @@
|
|||||||
# requiring a mount restart the systemctl
|
# requiring a mount restart the systemctl
|
||||||
# command is used with the "reload-or-restart"
|
# command is used with the "reload-or-restart"
|
||||||
# argument. Additionally this command escapes
|
# argument. Additionally this command escapes
|
||||||
# the name of the mount.
|
# the name of the mount. If this command fails
|
||||||
- name: Set the state of the mount
|
# the task will be rescued and the regular
|
||||||
shell: >-
|
# systemd module will be attempted before
|
||||||
systemctl
|
# failing the task run.
|
||||||
{{ systemd_mount_states[item.state] }}
|
- name: Mount state block
|
||||||
$(systemd-escape -p --suffix="{{ systemd_mount_suffix }}" "{{ systemd_mount_item }}")
|
block:
|
||||||
args:
|
- name: Set the state of the mount
|
||||||
warn: no
|
shell: >-
|
||||||
when:
|
systemctl
|
||||||
- item.state is defined
|
{{ systemd_mount_states[item.state] }}
|
||||||
tags:
|
$(systemd-escape -p --suffix="{{ systemd_mount_suffix }}" "{{ systemd_mount_item }}")
|
||||||
- skip_ansible_lint
|
args:
|
||||||
|
warn: no
|
||||||
|
when:
|
||||||
|
- 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)
|
- name: Unload mount(s)
|
||||||
systemd:
|
systemd:
|
||||||
|
Loading…
Reference in New Issue
Block a user