---
- name: Unload nmi_watchdog
  modprobe:
    name: nmi_watchdog
    state: absent

- name: Unload softdog
  modprobe:
    name: softdog
    state: absent

- name: Disable nmi_watchdog via GRUB config
  lineinfile:
    dest: /etc/default/grub
    line: 'GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX nmi_watchdog=0"'
    insertafter: '^GRUB_CMDLINE_LINUX="'
  register: __proxmox_grub

- name: Update GRUB configuration
  command: update-grub
  register: __proxmox_grub_update
  failed_when: ('error' in __proxmox_grub_update.stderr)
  when: __proxmox_grub|changed
  tags: skiponlxc

---
- name: Unload nmi_watchdog
  modprobe:
    name: nmi_watchdog
    state: absent

- name: Attempt to unload softdog live
  modprobe:
    name: softdog
    state: absent
  ignore_errors: true
  register: __proxmox_rmmod_softdog

- block:

  - name: Stop watchdog-mux
    service:
      name: watchdog-mux
      state: stopped
    notify:
      - restart watchdog-mux

  - name: Unload softdog
    modprobe:
      name: softdog
      state: absent

  when: __proxmox_rmmod_softdog|failed

- name: Disable nmi_watchdog via GRUB config
  lineinfile:
    dest: /etc/default/grub
    line: 'GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX nmi_watchdog=0"'
    insertafter: '^GRUB_CMDLINE_LINUX="'
  register: __proxmox_grub

- name: Update GRUB configuration
  command: update-grub
  register: __proxmox_grub_update
  failed_when: ('error' in __proxmox_grub_update.stderr)
  when: __proxmox_grub|changed
  tags: skiponlxc

Remove softdog module on live systems too (fix)
Remove softdog module on live systems too (fix)
