ansible-roles/mysql/tasks/replication.yml

42 lines
931 B
YAML

---
- name: 'Copy MySQL configuration for replication'
template:
src: 'replication.cnf.j2'
dest: "{{ mysql_config_directory }}/zzzz-replication.cnf"
mode: "0644"
notify: 'restart mysql'
- name: 'Create repl user'
mysql_user:
name: 'repl'
host: '%'
encrypted: true
password: "{{ mysql_repl_password }}"
priv: '*.*:REPLICATION SLAVE,REPLICATION CLIENT'
update_password: 'on_create'
state: 'present'
register: create_repl_user
when: mysql_repl_password | length > 0
- name: 'Install xinetd'
apt:
name: 'xinetd'
- name: 'Add xinetd configuration for MySQL HAProxy check'
copy:
src: 'xinetd/mysqlchk'
dest: '/etc/xinetd.d/'
mode: '0644'
notify: 'restart xinetd'
# /!\ Warning, this is a temporary hack
- include_role:
name: remount-usr
- name: 'Copy mysqlchk script'
copy:
src: 'xinetd/mysqlchk.sh'
dest: '/usr/share/scripts/'
mode: '0755'