made environment file for the service.

I am unable to reproduce systemctl set-environment to work as
advertized.
This commit is contained in:
Egon Rijpkema 2017-10-18 17:11:23 +02:00
parent 7218694901
commit fe708539f0
2 changed files with 14 additions and 2 deletions

View File

@ -41,9 +41,17 @@
- 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.
command: systemctl set-environment _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
lineinfile:
path: /srv/mariadb/systemd_environment
line: _WSREP_NEW_CLUSTER='--wsrep-new-cluster'
when: groups['databases'] | length >= 3 and ansible_hostname == hostname_node0
- name: make sure service is started
@ -52,4 +60,7 @@
state: started
- name: Prevent cluster re-initialization
command: systemctl set-environment _WSREP_NEW_CLUSTER=''
lineinfile:
path: /srv/mariadb/systemd_environment
state: absent
line: _WSREP_NEW_CLUSTER='--wsrep-new-cluster'

View File

@ -6,6 +6,7 @@ Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
EnvironmentFile=/srv/mariadb/systemd_environment
ExecStartPre=-/usr/bin/docker kill %n || /bin/true
ExecStartPre=-/usr/bin/docker rm %n
ExecStartPre=/usr/bin/docker pull mariadb:10.2