Reverted to updating init file by ansible.
entrypoint.sh of the mariadb container seems unable to cope when a blank variable is passed by systemd.
This commit is contained in:
@ -5,14 +5,6 @@
|
||||
file: ../../secrets.yml
|
||||
name: secrets
|
||||
|
||||
- name: install service file.
|
||||
template:
|
||||
src: templates/mysql.service
|
||||
dest: /etc/systemd/system/mysql.service
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: make mariadb settings volume
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
@ -36,31 +28,44 @@
|
||||
mode: 660
|
||||
when: groups['databases'] | length >= 3
|
||||
|
||||
- command: systemctl daemon-reload
|
||||
|
||||
- name: start service at boot.
|
||||
command: systemctl reenable mysql.service
|
||||
|
||||
- name: create environment file for systemd
|
||||
copy:
|
||||
content: ""
|
||||
dest: /srv/mariadb/systemd_environment
|
||||
mode: 0644
|
||||
|
||||
# This mimics galera_new_cluster.sh
|
||||
# This mimics galera_new_cluster.sh
|
||||
- name: Initialize a new cluster.
|
||||
lineinfile:
|
||||
path: /srv/mariadb/systemd_environment
|
||||
line: _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
|
||||
block:
|
||||
- set_fact:
|
||||
mariadb_args: "--wsrep-new-cluster"
|
||||
|
||||
- template:
|
||||
src: templates/mysql.service
|
||||
dest: /etc/systemd/system/mysql.service
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- command: systemctl daemon-reload
|
||||
|
||||
- systemd:
|
||||
name: mysql.service
|
||||
state: started
|
||||
|
||||
when: groups['databases'] | length >= 3 and ansible_hostname == hostname_node0
|
||||
|
||||
- name: install service file.
|
||||
block:
|
||||
- set_fact:
|
||||
mariadb_args: ""
|
||||
- template:
|
||||
src: templates/mysql.service
|
||||
dest: /etc/systemd/system/mysql.service
|
||||
mode: 644
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- command: systemctl daemon-reload
|
||||
|
||||
- name: make sure service is started
|
||||
systemd:
|
||||
name: mysql.service
|
||||
state: started
|
||||
|
||||
- name: Prevent cluster re-initialization
|
||||
lineinfile:
|
||||
path: /srv/mariadb/systemd_environment
|
||||
state: absent
|
||||
line: _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
|
||||
- name: start service at boot.
|
||||
command: systemctl reenable mysql.service
|
||||
|
Reference in New Issue
Block a user