Initial project commit
This commit is contained in:
2
roles/rear_unmount/defaults/main.yml
Normal file
2
roles/rear_unmount/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
rear_unmount_nfs_path: /var/tmp/nfs_mnt
|
25
roles/rear_unmount/tasks/main.yml
Normal file
25
roles/rear_unmount/tasks/main.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Try to unmount the filesystem
|
||||
block:
|
||||
- name: Unmount filesystem
|
||||
ansible.posix.mount:
|
||||
path: "{{ rear_unmount_nfs_path }}"
|
||||
state: unmounted
|
||||
delay: 3
|
||||
retries: 3
|
||||
rescue:
|
||||
- name: "Rescue: Lazy unmount the NFS share"
|
||||
ansible.builtin.command:
|
||||
cmd: "umount -l {{ rear_unmount_nfs_path }}"
|
||||
|
||||
- name: Log unmount rescue to syslogger
|
||||
community.general.syslogger:
|
||||
msg: "{{ lookup('template', 'syslog.j2') | replace('\n', ' ') }}"
|
||||
ident: ansbl_rear_unmount_rescue
|
||||
vars:
|
||||
actor: "rear_unmount_rescue"
|
||||
title: >
|
||||
ReaR Unmount Rescue
|
||||
summary: "Unable to unmount the filesystem {{ rear_unmount_nfs_path }} using POSIX module. Rescued via lazy unmount."
|
||||
severity: "high"
|
||||
flags: ["inhibitor"]
|
17
roles/rear_unmount/templates/syslog.j2
Normal file
17
roles/rear_unmount/templates/syslog.j2
Normal file
@ -0,0 +1,17 @@
|
||||
actor="{{ actor | default(item.actor) }}"
|
||||
title="{{ title | default(item.title) }}"
|
||||
{% if (item.actor is defined) and item.actor in remeditated_inhibitors %}
|
||||
flags="{{ item.flags + ['remediated_in_automation'] }}"
|
||||
{% else %}
|
||||
flags="{{ flags | default(item.flags) }}"
|
||||
{% endif %}
|
||||
summary="{{ summary | default(item.summary) }}"
|
||||
severity="{{ severity | default(item.severity) }}"
|
||||
{% if item.detail.remediations is defined %}
|
||||
remediation="{{
|
||||
item.detail.remediations | selectattr('type', 'equalto', 'hint') |
|
||||
map(attribute='context') | join(', ') }}"
|
||||
{% else %}
|
||||
remediation="{{ remediation | default('') }}"
|
||||
{% endif %}
|
||||
ansible_tower_job_id="{{ tower_job_id | default(None) }}"
|
Reference in New Issue
Block a user