Add a keepalived role.
This commit is contained in:
parent
e47e727f69
commit
0ddf29358c
3 changed files with 52 additions and 0 deletions
|
@ -147,3 +147,6 @@
|
|||
|
||||
- name: restart varnish
|
||||
service: name=varnish state=restarted
|
||||
|
||||
- name: restart keepalived
|
||||
service: name=keepalived state=restarted
|
||||
|
|
27
roles/keepalived/tasks/main.yml
Normal file
27
roles/keepalived/tasks/main.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# role for keepalived
|
||||
# This role needs several variables defined:
|
||||
#
|
||||
# keepalived_interface - interface to listen on
|
||||
# keepalived_priority - priority of this host
|
||||
# keepalived_ipaddress - virtual ip address on master host
|
||||
#
|
||||
|
||||
- name: Install keepalived package
|
||||
yum: state=present name=keepalived
|
||||
tags:
|
||||
- packages
|
||||
- keepalived
|
||||
|
||||
- name: Install keepalived template
|
||||
template: src=keepalived.conf.j2 dest=/etc/keepalived.conf
|
||||
tags:
|
||||
- config
|
||||
- keepalived
|
||||
notify:
|
||||
- restart keepalived
|
||||
|
||||
- name: Make sure keepalived is set to start and is running
|
||||
service: state=running enabled=true name=keepalived
|
||||
- service
|
||||
- keepalived
|
22
roles/keepalived/templates/keepalived.conf.j2
Normal file
22
roles/keepalived/templates/keepalived.conf.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
global_defs {
|
||||
notification_email {
|
||||
admin@fedoraproject.org
|
||||
}
|
||||
notification_email_from keepalived
|
||||
smtp_server 10.5.126.12
|
||||
smtp_connect_timeout 30
|
||||
}
|
||||
|
||||
vrrp_instance VI_1 {
|
||||
# initial state
|
||||
state BACKUP
|
||||
interface {{ keepalived_interface }}
|
||||
# arbitary unique number 0..255
|
||||
# used to differentiate multiple instances of vrrpd
|
||||
virtual_router_id 17
|
||||
# for electing MASTER, highest priority wins.
|
||||
# to be MASTER, make 50 more than other machines.
|
||||
priority {{ keepalived_priority }}
|
||||
virtual_ipaddress {
|
||||
{{ keepalived_ipaddress }}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue