From c89622c4b4335d732c96c5b86782be5be6bfce9f Mon Sep 17 00:00:00 2001 From: Ricky Elrod Date: Mon, 18 Jan 2016 16:45:51 +0000 Subject: [PATCH] remove staging conditional on watchdog stuff, add conditionals for ensuring /dev/watchdog exists and that we are on a VM Signed-off-by: Ricky Elrod --- inventory/group_vars/all | 2 +- inventory/group_vars/staging | 9 --------- roles/base/tasks/main.yml | 13 +++++++++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/inventory/group_vars/all b/inventory/group_vars/all index 840673127a..b51d170f79 100644 --- a/inventory/group_vars/all +++ b/inventory/group_vars/all @@ -51,7 +51,7 @@ virt_install_command: virt-install -n {{ inventory_hostname }} -r {{ mem_size }} hostname={{ inventory_hostname }} nameserver={{ dns }} ip={{ eth0_ip }}::{{ gw }}:{{ nm }}:{{ inventory_hostname }}:eth0:none' --network bridge=br0,model=virtio - --autostart --noautoconsole + --autostart --noautoconsole --watchdog default # This is the wildcard certname for our proxies. It has a different name for # the staging group and is used in the proxies.yml playbook. diff --git a/inventory/group_vars/staging b/inventory/group_vars/staging index f083e2b2be..cd9c3a2cb2 100644 --- a/inventory/group_vars/staging +++ b/inventory/group_vars/staging @@ -12,12 +12,3 @@ collectd_graphite: True fedmsg_prefix: org.fedoraproject fedmsg_env: stg - -virt_install_command: virt-install -n {{ inventory_hostname }} -r {{ mem_size }} - --disk bus=virtio,path={{ volgroup }}/{{ inventory_hostname }} - --vcpus={{ num_cpus }} -l {{ ks_repo }} -x - 'ksdevice=eth0 ks={{ ks_url }} console=tty0 console=ttyS0 - hostname={{ inventory_hostname }} nameserver={{ dns }} - ip={{ eth0_ip }}::{{ gw }}:{{ nm }}:{{ inventory_hostname }}:eth0:none' - --network bridge=br0,model=virtio - --autostart --noautoconsole --watchdog default diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 9350dbfc83..1ea58e9b20 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -350,6 +350,11 @@ # # Watchdog stuff # +- name: See if there's 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: @@ -358,7 +363,7 @@ - packages - watchdog - base - when: ansible_distribution_major_version|int < 22 and env == 'staging' + 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 @@ -368,11 +373,11 @@ - packages - watchdog - base - when: ansible_distribution_major_version|int > 21 and env == 'staging' + 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: env == 'staging' + when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists tags: - config - watchdog @@ -381,7 +386,7 @@ - name: Set watchdog to run on boot service: name=watchdog enabled=yes - when: env == 'staging' + when: ansible_virtualization_role == 'guest' and watchdog_dev.stat.exists ignore_errors: true notify: - restart watchdog