summaryrefslogtreecommitdiffstats
path: root/roles/keepalived
diff options
context:
space:
mode:
authorKevin Fenzi <kevin@scrye.com>2015-01-16 18:57:25 +0000
committerKevin Fenzi <kevin@scrye.com>2015-01-16 18:57:25 +0000
commit1ba5dc01a5741fd6363f3955de102bfa0339f081 (patch)
treeb602bd7ae8c6a9c15e88ec7a1b110cc239b86495 /roles/keepalived
parent9fa2c79048ca85f0a9db3fd86fccd297119b4c62 (diff)
downloadansible-1ba5dc01a5741fd6363f3955de102bfa0339f081.tar.gz
ansible-1ba5dc01a5741fd6363f3955de102bfa0339f081.tar.xz
ansible-1ba5dc01a5741fd6363f3955de102bfa0339f081.zip
Add in cron and kojira tasks for passive hub. Add keepalived script to enable/disable on master/backup.
Diffstat (limited to 'roles/keepalived')
-rw-r--r--roles/keepalived/files/keepalived-notify.sh34
-rw-r--r--roles/keepalived/files/keepalived-notify.sh.koji02.phx2.fedoraproject.org34
-rw-r--r--roles/keepalived/tasks/main.yml9
-rw-r--r--roles/keepalived/templates/keepalived.conf.j21
4 files changed, 78 insertions, 0 deletions
diff --git a/roles/keepalived/files/keepalived-notify.sh b/roles/keepalived/files/keepalived-notify.sh
new file mode 100644
index 000000000..f0643f4a0
--- /dev/null
+++ b/roles/keepalived/files/keepalived-notify.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+TYPE=$1
+NAME=$2
+STATE=$3
+
+#
+# We are becoming master node
+#
+if [ $STATE == "MASTER" ]; then
+ # systemctl stop kojira
+ # rm -f /etc/cron.d/kojifix
+ # rm -f /etc/cron.d/koji-directory-cleanup
+ # rm -f /etc/cron.d/koji-gc
+ # rm -f /etc/cron.d/koji-prunesigs
+ logger "just became keepalived master"
+
+fi
+#
+# We are becoming the backup node
+#
+if [ $STATE == "BACKUP" ]; then
+ # systemctl start kojira
+ # /etc/cron.d/kojifix
+ # rm -f /etc/cron.d/koji-directory-cleanup
+ # rm -f /etc/cron.d/koji-gc
+ # rm -f /etc/cron.d/koji-prunesigs
+ logger "just became keepalived backup"
+fi
+#
+# something horrible has gone wrong
+#
+if [ $STATE == "FAULT" ]; then
+ logger "just had a keepalived fault"
+fi
diff --git a/roles/keepalived/files/keepalived-notify.sh.koji02.phx2.fedoraproject.org b/roles/keepalived/files/keepalived-notify.sh.koji02.phx2.fedoraproject.org
new file mode 100644
index 000000000..f0643f4a0
--- /dev/null
+++ b/roles/keepalived/files/keepalived-notify.sh.koji02.phx2.fedoraproject.org
@@ -0,0 +1,34 @@
+#!/bin/bash
+TYPE=$1
+NAME=$2
+STATE=$3
+
+#
+# We are becoming master node
+#
+if [ $STATE == "MASTER" ]; then
+ # systemctl stop kojira
+ # rm -f /etc/cron.d/kojifix
+ # rm -f /etc/cron.d/koji-directory-cleanup
+ # rm -f /etc/cron.d/koji-gc
+ # rm -f /etc/cron.d/koji-prunesigs
+ logger "just became keepalived master"
+
+fi
+#
+# We are becoming the backup node
+#
+if [ $STATE == "BACKUP" ]; then
+ # systemctl start kojira
+ # /etc/cron.d/kojifix
+ # rm -f /etc/cron.d/koji-directory-cleanup
+ # rm -f /etc/cron.d/koji-gc
+ # rm -f /etc/cron.d/koji-prunesigs
+ logger "just became keepalived backup"
+fi
+#
+# something horrible has gone wrong
+#
+if [ $STATE == "FAULT" ]; then
+ logger "just had a keepalived fault"
+fi
diff --git a/roles/keepalived/tasks/main.yml b/roles/keepalived/tasks/main.yml
index d67d19c2c..be57c5db2 100644
--- a/roles/keepalived/tasks/main.yml
+++ b/roles/keepalived/tasks/main.yml
@@ -21,6 +21,15 @@
notify:
- restart keepalived
+- name: Install keepalived failover script for host (or default)
+ copy: src={{ item }} dest=/usr/local/bin/keepalived-notify.sh mode=755
+ with_first_found:
+ - keepalived-notify.sh.{{ ansible_fqdn }}
+ - keepalived-notify.sh
+ tags:
+ - config
+ - keepalived
+
- name: Make sure keepalived is set to start and is running
service: state=running enabled=true name=keepalived
tags:
diff --git a/roles/keepalived/templates/keepalived.conf.j2 b/roles/keepalived/templates/keepalived.conf.j2
index f75776657..d8cad097e 100644
--- a/roles/keepalived/templates/keepalived.conf.j2
+++ b/roles/keepalived/templates/keepalived.conf.j2
@@ -19,4 +19,5 @@ vrrp_instance VI_1 {
priority {{ keepalived_priority }}
virtual_ipaddress {
{{ keepalived_ipaddress }}
+ notify /usr/local/bin/keepalived-notify.sh
}