File tree 4 files changed +12
-4
lines changed
provision-contest/ansible/roles
4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
vrrp_instance lb_ipv4 {
2
2
state MASTER
3
- interface {{ ansible_facts['default_ipv4'] ['interface'] }}
3
+ interface {{ KEEPALIVED_INTERFACE|default( ansible_facts['default_ipv4'] ['interface'] ) }}
4
4
use_vmac
5
5
virtual_router_id 32
6
6
priority {{KEEPALIVED_PRIORITY}}
Original file line number Diff line number Diff line change 13
13
regexp : ' ^bind-address\s*='
14
14
replace : ' #bind-address ='
15
15
16
+ - name : Set the replication interface variable
17
+ set_fact :
18
+ replication_interface : " {{ REPLICATION_INTERFACE|default(ansible_default_ipv4.interface) }}"
19
+
20
+ - name : Set the variable for the IP address of the replication interface
21
+ set_fact :
22
+ replication_interface_ip_address : " {{ vars['ansible_' + replication_interface]['ipv4']['address'] }}"
23
+
16
24
- name : Add mysql config snippet for replication
17
25
template :
18
26
src : mysql.replication.cnf.j2
Original file line number Diff line number Diff line change @@ -8,4 +8,4 @@ log-bin = /var/log/mysql/mysql-bin.log
8
8
binlog_do_db = domjudge
9
9
10
10
# Host specific replication configuration
11
- server_id = {{ ansible_default_ipv4.address | ipaddr('int') }}
11
+ server_id = {{ replication_interface_ip_address | ipaddr('int') }}
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ service mysql start
181
181
182
182
echo " Starting replication locally..."
183
183
mysql -e "
184
- CHANGE MASTER TO MASTER_HOST='{{ SERVER_IP_PREFIX }}. ${PRIMARY_SERVER_ID } ',
184
+ CHANGE MASTER TO MASTER_HOST='${PRIMARY } ',
185
185
MASTER_USER='replication',
186
186
MASTER_PASSWORD='{{ REPLICATION_PASSWORD }}',
187
187
MASTER_LOG_FILE='${PRIMARY_BINLOG} ',
@@ -217,7 +217,7 @@ OUR_LOGPOS=$(get_field 'Position' "$OUR_STATUS")
217
217
if [ " $SETUP_MASTER_MASTER " -eq 1 ]; then
218
218
echo " Starting replication on $PRIMARY ..."
219
219
ssh " $PRIMARY " " mysql -e '
220
- CHANGE MASTER TO MASTER_HOST=\" {{ SERVER_IP_PREFIX }}. ${OUR_SERVER_ID }\" ,
220
+ CHANGE MASTER TO MASTER_HOST=\" {{ replication_interface_ip_address } }\" ,
221
221
MASTER_USER=\" replication\" ,
222
222
MASTER_PASSWORD=\" {{ REPLICATION_PASSWORD }}\" ,
223
223
MASTER_LOG_FILE=\" ${OUR_BINLOG} \" ,
You can’t perform that action at this time.
0 commit comments