File tree Expand file tree Collapse file tree 6 files changed +42
-23
lines changed Expand file tree Collapse file tree 6 files changed +42
-23
lines changed Original file line number Diff line number Diff line change 1
1
---
2
+ nginx_keepalived_enable : false
2
3
nginx_keepalived_conf_enable : false
3
4
nginx_keepalived_conf :
4
5
- virtual_router_id : 1
5
6
primary_dev : eth0
6
7
priority : 101
7
8
primary_ip : 192.168.100.100
8
- secondary_ip : 192.168.100.101
9
- cluster_ip : 192.168.100.150
9
+ secondary_ip :
10
+ - 192.168.100.101
11
+ cluster_ip :
12
+ - 192.168.100.150
Original file line number Diff line number Diff line change 29
29
- set-misc
30
30
- subs-filter
31
31
- xslt
32
+ nginx_keepalived_enable : true
32
33
nginx_keepalived_conf_enable : true
34
+ nginx_keepalived_conf :
35
+ - virtual_router_id : 1
36
+ primary_dev : eth0
37
+ priority : 101
38
+ primary_ip : 192.168.100.100
39
+ secondary_ip :
40
+ - 192.168.100.101
41
+ cluster_ip :
42
+ - 192.168.100.150
Original file line number Diff line number Diff line change 74
74
- nginx_state != 'absent'
75
75
tags : nginx_logrotate_config
76
76
77
- - name : Configure NGINX Plus keepalived HA
78
- ansible.builtin.include_tasks : " {{ role_path }}/tasks/modules/install-keepalived .yml"
77
+ - name : Install and configure NGINX Plus keepalived HA
78
+ ansible.builtin.include_tasks : " {{ role_path }}/tasks/modules/install-packages .yml"
79
79
when :
80
- - nginx_keepalived_conf_enable | bool
80
+ - nginx_keepalived_enable | bool or nginx_keepalived_conf_enable | bool
81
81
- nginx_type == 'plus'
82
82
- nginx_state != 'absent'
83
- tags : nginx_logrotate_config
83
+ tags : nginx_keepalived
84
84
85
85
- name : Install NGINX Amplify
86
86
ansible.builtin.include_tasks : " {{ role_path }}/tasks/amplify/install-amplify.yml"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Install NGINX Plus HA keepalived package
3
+ ansible.builtin.package :
4
+ name : nginx-ha-keepalived
5
+ state : present
6
+ when :
7
+ - nginx_keepalived_enable | bool
8
+ - ansible_facts['os_family'] != 'Alpine' or ansible_facts['distribution'] != 'Amazon'
9
+ notify : (Handler) Start NGINX Plus HA keepalived
10
+
11
+ - name : Configure NGINX Plus keepalived HA
12
+ ansible.builtin.template :
13
+ src : keepalived/keepalived.conf.tmpl.j2
14
+ dest : /etc/keepalived/keepalived.conf
15
+ mode : " 0644"
16
+ when :
17
+ - nginx_keepalived_conf_enable | bool
18
+ - ansible_facts['os_family'] != 'Alpine' or ansible_facts['distribution'] != 'Amazon'
19
+ notify : (Handler) Start NGINX Plus HA keepalived
Original file line number Diff line number Diff line change @@ -27,10 +27,14 @@ vrrp_instance VI_{{ vrrp['virtual_router_id'] }} {
27
27
garp_master_refresh_repeat 1
28
28
unicast_src_ip {{ vrrp['primary_ip'] }}
29
29
unicast_peer {
30
+ {% for ip in vrrp ['secondary_ip' ] %}
30
31
{{ vrrp['secondary_ip'] }}
32
+ {% endfor %}
31
33
}
32
34
virtual_ipaddress {
35
+ {% for ip in {{ vrrp ['cluster_ip' ] }} %}
33
36
{{ vrrp['cluster_ip'] }}
37
+ {% endfor %}
34
38
}
35
39
track_script {
36
40
chk_nginx_service
You can’t perform that action at this time.
0 commit comments