Refactor the condition to setup the watchdog with a block

This commit is contained in:
Michael Scherer 2016-04-04 02:59:10 +02:00 committed by Kevin Fenzi
parent 2b470d2fa0
commit 2f26bd0f63

View file

@ -3,7 +3,9 @@
when: ansible_virtualization_role == 'guest' when: ansible_virtualization_role == 'guest'
register: watchdog_dev register: watchdog_dev
- name: install watchdog - block:
- name: install watchdog
package: pkg={{ item }} state=present package: pkg={{ item }} state=present
with_items: with_items:
- watchdog - watchdog
@ -11,20 +13,17 @@
- packages - packages
- watchdog - watchdog
- base - base
when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
- name: watchdog device configuration - name: watchdog device configuration
copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644 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: tags:
- config - config
- watchdog - watchdog
- base - base
notify: restart watchdog notify: restart watchdog
- name: Set watchdog to run on boot - name: Set watchdog to run on boot
service: name=watchdog enabled=yes service: name=watchdog enabled=yes
when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists
ignore_errors: true ignore_errors: true
notify: notify:
- restart watchdog - restart watchdog
@ -32,3 +31,4 @@
- service - service
- watchdog - watchdog
- base - base
when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists