From: Michael Scherer <misc(a)zarb.org>
---
roles/base/tasks/main.yml | 46 ++-----------------------------------------
roles/base/tasks/watchdog.yml | 44 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 44 deletions(-)
create mode 100644 roles/base/tasks/watchdog.yml
diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml
index ddc751d..8139bb0 100644
--- a/roles/base/tasks/main.yml
+++ b/roles/base/tasks/main.yml
@@ -408,47 +408,5 @@
#
# Watchdog stuff
#
-- name: See if theres a watchdog device
- stat: path=/dev/watchdog
- when: ansible_virtualization_role == 'guest'
- register: watchdog_dev
-
-- name: install watchdog
- yum: pkg={{ item }} state=present
- with_items:
- - watchdog
- tags:
- - packages
- - watchdog
- - base
- when: ansible_distribution_major_version|int < 22 and ansible_virtualization_role ==
'guest' and watchdog_dev.stat.exists
-
-- name: install watchdog
- dnf: pkg={{ item }} state=present
- with_items:
- - watchdog
- tags:
- - packages
- - watchdog
- - base
- when: ansible_distribution_major_version|int > 21 and ansible_virtualization_role ==
'guest' and watchdog_dev.stat.exists
-
-- name: watchdog device configuration
- copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644
- when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
- tags:
- - config
- - watchdog
- - base
- notify: restart watchdog
-
-- name: Set watchdog to run on boot
- service: name=watchdog enabled=yes
- when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
- ignore_errors: true
- notify:
- - restart watchdog
- tags:
- - service
- - watchdog
- - base
+- name: Set up watchdog
+ include: watchdog.yml
diff --git a/roles/base/tasks/watchdog.yml b/roles/base/tasks/watchdog.yml
new file mode 100644
index 0000000..6ae0d54
--- /dev/null
+++ b/roles/base/tasks/watchdog.yml
@@ -0,0 +1,44 @@
+- name: See if theres a watchdog device
+ stat: path=/dev/watchdog
+ when: ansible_virtualization_role == 'guest'
+ register: watchdog_dev
+
+- name: install watchdog
+ yum: pkg={{ item }} state=present
+ with_items:
+ - watchdog
+ tags:
+ - packages
+ - watchdog
+ - base
+ when: ansible_distribution_major_version|int < 22 and ansible_virtualization_role ==
'guest' and watchdog_dev.stat.exists
+
+- name: install watchdog
+ dnf: pkg={{ item }} state=present
+ with_items:
+ - watchdog
+ tags:
+ - packages
+ - watchdog
+ - base
+ when: ansible_distribution_major_version|int > 21 and ansible_virtualization_role ==
'guest' and watchdog_dev.stat.exists
+
+- name: watchdog device configuration
+ copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644
+ when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
+ tags:
+ - config
+ - watchdog
+ - base
+ notify: restart watchdog
+
+- name: Set watchdog to run on boot
+ service: name=watchdog enabled=yes
+ when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
+ ignore_errors: true
+ notify:
+ - restart watchdog
+ tags:
+ - service
+ - watchdog
+ - base
--
1.8.3.1
Show replies by date
From: Michael Scherer <misc(a)zarb.org>
---
roles/base/tasks/watchdog.yml | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/roles/base/tasks/watchdog.yml b/roles/base/tasks/watchdog.yml
index 6ae0d54..feebcfc 100644
--- a/roles/base/tasks/watchdog.yml
+++ b/roles/base/tasks/watchdog.yml
@@ -4,24 +4,14 @@
register: watchdog_dev
- name: install watchdog
- yum: pkg={{ item }} state=present
+ package: pkg={{ item }} state=present
with_items:
- watchdog
tags:
- packages
- watchdog
- base
- when: ansible_distribution_major_version|int < 22 and ansible_virtualization_role ==
'guest' and watchdog_dev.stat.exists
-
-- name: install watchdog
- dnf: pkg={{ item }} state=present
- with_items:
- - watchdog
- tags:
- - packages
- - watchdog
- - base
- when: ansible_distribution_major_version|int > 21 and ansible_virtualization_role ==
'guest' and watchdog_dev.stat.exists
+ when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
- name: watchdog device configuration
copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644
--
1.8.3.1
From: Michael Scherer <misc(a)zarb.org>
---
roles/base/tasks/watchdog.yml | 52 +++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 26 deletions(-)
diff --git a/roles/base/tasks/watchdog.yml b/roles/base/tasks/watchdog.yml
index feebcfc..148c856 100644
--- a/roles/base/tasks/watchdog.yml
+++ b/roles/base/tasks/watchdog.yml
@@ -3,32 +3,32 @@
when: ansible_virtualization_role == 'guest'
register: watchdog_dev
-- name: install watchdog
- package: pkg={{ item }} state=present
- with_items:
- - watchdog
- tags:
- - packages
- - watchdog
- - base
- when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
+- block:
-- name: watchdog device configuration
- copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644
- when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
- tags:
- - config
- - watchdog
- - base
- notify: restart watchdog
+ - name: install watchdog
+ package: pkg={{ item }} state=present
+ with_items:
+ - watchdog
+ tags:
+ - packages
+ - watchdog
+ - base
+
+ - name: watchdog device configuration
+ copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644
+ tags:
+ - config
+ - watchdog
+ - base
+ notify: restart watchdog
-- name: Set watchdog to run on boot
- service: name=watchdog enabled=yes
+ - name: Set watchdog to run on boot
+ service: name=watchdog enabled=yes
+ ignore_errors: true
+ notify:
+ - restart watchdog
+ tags:
+ - service
+ - watchdog
+ - base
when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
- ignore_errors: true
- notify:
- - restart watchdog
- tags:
- - service
- - watchdog
- - base
--
1.8.3.1