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'