From edc4b7067d6ab7dd5f2f2eaa038a953f24f83ce9 Mon Sep 17 00:00:00 2001 From: Ricky Elrod Date: Tue, 10 Nov 2015 20:11:11 +0000 Subject: [PATCH] watchdog-ify staging, hopefully Signed-off-by: Ricky Elrod --- inventory/group_vars/staging | 9 ++++ .../fedocal01.stg.phx2.fedoraproject.org | 9 ---- playbooks/groups/fedocal.yml | 1 - roles/base/files/watchdog.conf | 3 ++ roles/{watchdog => base}/handlers/main.yml | 0 roles/base/tasks/main.yml | 43 +++++++++++++++++++ roles/watchdog/files/watchdog-device | 1 - roles/watchdog/tasks/main.yml | 28 ------------ 8 files changed, 55 insertions(+), 39 deletions(-) create mode 100644 roles/base/files/watchdog.conf rename roles/{watchdog => base}/handlers/main.yml (100%) delete mode 100644 roles/watchdog/files/watchdog-device delete mode 100644 roles/watchdog/tasks/main.yml diff --git a/inventory/group_vars/staging b/inventory/group_vars/staging index cd9c3a2cb2..f083e2b2be 100644 --- a/inventory/group_vars/staging +++ b/inventory/group_vars/staging @@ -12,3 +12,12 @@ 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/inventory/host_vars/fedocal01.stg.phx2.fedoraproject.org b/inventory/host_vars/fedocal01.stg.phx2.fedoraproject.org index 24942d3113..601b0afd8d 100644 --- a/inventory/host_vars/fedocal01.stg.phx2.fedoraproject.org +++ b/inventory/host_vars/fedocal01.stg.phx2.fedoraproject.org @@ -10,12 +10,3 @@ volgroup: /dev/vg_guests eth0_ip: 10.5.126.66 vmhost: virthost11.phx2.fedoraproject.org datacenter: phx2 - -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/playbooks/groups/fedocal.yml b/playbooks/groups/fedocal.yml index 1f9f25c1fa..7d9a060779 100644 --- a/playbooks/groups/fedocal.yml +++ b/playbooks/groups/fedocal.yml @@ -12,7 +12,6 @@ roles: - base - - { role: watchdog, when: env == "staging" } - rkhunter - { role: denyhosts, when: ansible_distribution_major_version|int != 7 } - nagios_client diff --git a/roles/base/files/watchdog.conf b/roles/base/files/watchdog.conf new file mode 100644 index 0000000000..92254d82f4 --- /dev/null +++ b/roles/base/files/watchdog.conf @@ -0,0 +1,3 @@ +watchdog-device = /dev/watchdog +realtime = yes +priority = 1 diff --git a/roles/watchdog/handlers/main.yml b/roles/base/handlers/main.yml similarity index 100% rename from roles/watchdog/handlers/main.yml rename to roles/base/handlers/main.yml diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index a490509f67..d52053d29e 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -346,3 +346,46 @@ tags: - config - base + +# +# Watchdog stuff +# +- name: install watchdog + yum: pkg={{ item }} state=present + with_items: + - watchdog + tags: + - packages + - watchdog + - base + when: ansible_distribution_major_version|int < 22 && env == 'staging' + +- name: install watchdog + dnf: pkg={{ item }} state=present + with_items: + - watchdog + tags: + - packages + - watchdog + - base + when: ansible_distribution_major_version|int > 21 && env == 'staging' + +- name: watchdog device configuration + copy: src=watchdog.conf dest=/etc/watchdog.conf owner=root group=root mode=644 + when: env == 'staging' + tags: + - config + - watchdog + - base + notify: restart watchdog + +- name: Set watchdog to run on boot + service: name=watchdog enabled=yes + when: env == 'staging' + ignore_errors: true + notify: + - restart watchdog + tags: + - service + - watchdog + - base diff --git a/roles/watchdog/files/watchdog-device b/roles/watchdog/files/watchdog-device deleted file mode 100644 index c18f97a007..0000000000 --- a/roles/watchdog/files/watchdog-device +++ /dev/null @@ -1 +0,0 @@ -watchdog-device=/dev/watchdog diff --git a/roles/watchdog/tasks/main.yml b/roles/watchdog/tasks/main.yml deleted file mode 100644 index 1bea4ffdea..0000000000 --- a/roles/watchdog/tasks/main.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# -# Setup watchdog -# -- name: install needed packages - yum: pkg={{ item }} state=present - with_items: - - watchdog - tags: - - packages - - watchdog - when: ansible_distribution_major_version|int < 22 - -- name: install needed packages - dnf: pkg={{ item }} state=present - with_items: - - watchdog - tags: - - packages - - watchdog - when: ansible_distribution_major_version|int > 21 - -- name: watchdog device configuration - copy: src=watchdog-device dest=/etc/watchdog.d/watchdog-device owner=root group=root mode=644 - tags: - - config - - watchdog - notify: restart watchdog