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 11---
2+ nginx_keepalived_enable : false
23nginx_keepalived_conf_enable : false
34nginx_keepalived_conf :
45 - virtual_router_id : 1
56 primary_dev : eth0
67 priority : 101
78 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 2929 - set-misc
3030 - subs-filter
3131 - xslt
32+ nginx_keepalived_enable : true
3233 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 7474 - nginx_state != 'absent'
7575 tags : nginx_logrotate_config
7676
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"
7979 when :
80- - nginx_keepalived_conf_enable | bool
80+ - nginx_keepalived_enable | bool or nginx_keepalived_conf_enable | bool
8181 - nginx_type == 'plus'
8282 - nginx_state != 'absent'
83- tags : nginx_logrotate_config
83+ tags : nginx_keepalived
8484
8585- name : Install NGINX Amplify
8686 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'] }} {
2727 garp_master_refresh_repeat 1
2828 unicast_src_ip {{ vrrp['primary_ip'] }}
2929 unicast_peer {
30+ {% for ip in vrrp ['secondary_ip' ] %}
3031 {{ vrrp['secondary_ip'] }}
32+ {% endfor %}
3133 }
3234 virtual_ipaddress {
35+ {% for ip in {{ vrrp ['cluster_ip' ] }} %}
3336 {{ vrrp['cluster_ip'] }}
37+ {% endfor %}
3438 }
3539 track_script {
3640 chk_nginx_service
You can’t perform that action at this time.
0 commit comments