File tree Expand file tree Collapse file tree 4 files changed +12
-4
lines changed
provision-contest/ansible/roles Expand file tree Collapse file tree 4 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11vrrp_instance lb_ipv4 {
22 state MASTER
3- interface {{ ansible_facts['default_ipv4'] ['interface'] }}
3+ interface {{ KEEPALIVED_INTERFACE|default( ansible_facts['default_ipv4'] ['interface'] ) }}
44 use_vmac
55 virtual_router_id 32
66 priority {{KEEPALIVED_PRIORITY}}
Original file line number Diff line number Diff line change 1313 regexp : ' ^bind-address\s*='
1414 replace : ' #bind-address ='
1515
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+
1624- name : Add mysql config snippet for replication
1725 template :
1826 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
88binlog_do_db = domjudge
99
1010# 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
181181
182182echo " Starting replication locally..."
183183mysql -e "
184- CHANGE MASTER TO MASTER_HOST='{{ SERVER_IP_PREFIX }}. ${PRIMARY_SERVER_ID } ',
184+ CHANGE MASTER TO MASTER_HOST='${PRIMARY } ',
185185 MASTER_USER='replication',
186186 MASTER_PASSWORD='{{ REPLICATION_PASSWORD }}',
187187 MASTER_LOG_FILE='${PRIMARY_BINLOG} ',
@@ -217,7 +217,7 @@ OUR_LOGPOS=$(get_field 'Position' "$OUR_STATUS")
217217if [ " $SETUP_MASTER_MASTER " -eq 1 ]; then
218218 echo " Starting replication on $PRIMARY ..."
219219 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 } }\" ,
221221 MASTER_USER=\" replication\" ,
222222 MASTER_PASSWORD=\" {{ REPLICATION_PASSWORD }}\" ,
223223 MASTER_LOG_FILE=\" ${OUR_BINLOG} \" ,
You can’t perform that action at this time.
0 commit comments