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:
parent
fe708539f0
commit
cc9d780fbc
@ -5,14 +5,6 @@
|
|||||||
file: ../../secrets.yml
|
file: ../../secrets.yml
|
||||||
name: secrets
|
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
|
- name: make mariadb settings volume
|
||||||
file:
|
file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
@ -36,31 +28,44 @@
|
|||||||
mode: 660
|
mode: 660
|
||||||
when: groups['databases'] | length >= 3
|
when: groups['databases'] | length >= 3
|
||||||
|
|
||||||
- command: systemctl daemon-reload
|
# This mimics galera_new_cluster.sh
|
||||||
|
|
||||||
- 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
|
|
||||||
- name: Initialize a new cluster.
|
- name: Initialize a new cluster.
|
||||||
lineinfile:
|
block:
|
||||||
path: /srv/mariadb/systemd_environment
|
- set_fact:
|
||||||
line: _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
|
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
|
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
|
- name: make sure service is started
|
||||||
systemd:
|
systemd:
|
||||||
name: mysql.service
|
name: mysql.service
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Prevent cluster re-initialization
|
- name: start service at boot.
|
||||||
lineinfile:
|
command: systemctl reenable mysql.service
|
||||||
path: /srv/mariadb/systemd_environment
|
|
||||||
state: absent
|
|
||||||
line: _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
|
|
||||||
|
@ -6,7 +6,6 @@ Requires=docker.service
|
|||||||
[Service]
|
[Service]
|
||||||
TimeoutStartSec=0
|
TimeoutStartSec=0
|
||||||
Restart=always
|
Restart=always
|
||||||
EnvironmentFile=/srv/mariadb/systemd_environment
|
|
||||||
ExecStartPre=-/usr/bin/docker kill %n || /bin/true
|
ExecStartPre=-/usr/bin/docker kill %n || /bin/true
|
||||||
ExecStartPre=-/usr/bin/docker rm %n
|
ExecStartPre=-/usr/bin/docker rm %n
|
||||||
ExecStartPre=/usr/bin/docker pull mariadb:10.2
|
ExecStartPre=/usr/bin/docker pull mariadb:10.2
|
||||||
@ -14,8 +13,7 @@ ExecStart=/usr/bin/docker run --name %n \
|
|||||||
-p 3306:3306 -p 4567:4567 -p 4568:4568 -p 4444:4444 \
|
-p 3306:3306 -p 4567:4567 -p 4568:4568 -p 4444:4444 \
|
||||||
-v /srv/mariadb/lib/mysql:/var/lib/mysql \
|
-v /srv/mariadb/lib/mysql:/var/lib/mysql \
|
||||||
-v /srv/mariadb/etc/mysql/conf.d:/etc/mysql/conf.d \
|
-v /srv/mariadb/etc/mysql/conf.d:/etc/mysql/conf.d \
|
||||||
-e MYSQL_ROOT_PASSWORD={{ secrets['MYSQL_ROOT_PASSWORD'] }} mariadb:10.2 \
|
-e MYSQL_ROOT_PASSWORD={{ secrets['MYSQL_ROOT_PASSWORD'] }} mariadb:10.2 {{ mariadb_args }}
|
||||||
${MYSQLD_OPTS} ${_WSREP_NEW_CLUSTER} ${_WSREP_START_POSITION}
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
Loading…
Reference in New Issue
Block a user