From baa97f1df2035e2db969152f64b28b791e25d3d9 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 23 Jan 2018 18:14:43 +0000 Subject: [PATCH] tasks: galera_post_install: Configure the service before securing the DB The DB secure tool attempts to start the DB but this may fail if the systemd service is not configured properly. As such, we move the service configuration tasks before those that secure the db. Change-Id: I49f5cee0494b89d5018056fbed84f52a67aa7399 --- tasks/galera_post_install.yml | 54 +++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/tasks/galera_post_install.yml b/tasks/galera_post_install.yml index 82585e7e..b518dc53 100644 --- a/tasks/galera_post_install.yml +++ b/tasks/galera_post_install.yml @@ -13,6 +13,35 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Create mariadb systemd service config dir + file: + path: "/etc/systemd/system/{{ galera_mariadb_service_name }}.service.d" + state: "directory" + group: "root" + owner: "root" + mode: "0755" + +- name: Apply systemd options + template: + src: "{{ item.src }}" + dest: "/etc/systemd/system/{{ galera_mariadb_service_name }}.service.d/{{ item.dest }}" + mode: "0644" + with_items: + - { src: "systemd.environment.conf.j2", dest: "environment.conf" } + - { src: "systemd.limits.conf.j2", dest: "limits.conf" } + - { src: "systemd.restart.conf.j2", dest: "restart.conf" } + - { src: "systemd.slice.conf.j2", dest: "slice.conf" } + - { src: "systemd.timeout.conf.j2", dest: "timeout.conf" } + - { src: "systemd.without-privatedevices.conf.j2", dest: "without-privatedevices.conf" } + notify: + - Manage LB + - Reload the systemd daemon + - Restart all mysql + +- name: Reload systemd service files + systemd: + daemon_reload: yes + # NOTE(cloudnull): The secure task is not needed on Debian based systems # as all of these tasks will be run on Package install # and running them again will cause a conflict within @@ -125,31 +154,6 @@ dest: "/etc/default/mysql" state: "link" -- name: Create mariadb systemd service config dir - file: - path: "/etc/systemd/system/{{ galera_mariadb_service_name }}.service.d" - state: "directory" - group: "root" - owner: "root" - mode: "0755" - -- name: Apply systemd options - template: - src: "{{ item.src }}" - dest: "/etc/systemd/system/{{ galera_mariadb_service_name }}.service.d/{{ item.dest }}" - mode: "0644" - with_items: - - { src: "systemd.environment.conf.j2", dest: "environment.conf" } - - { src: "systemd.limits.conf.j2", dest: "limits.conf" } - - { src: "systemd.restart.conf.j2", dest: "restart.conf" } - - { src: "systemd.slice.conf.j2", dest: "slice.conf" } - - { src: "systemd.timeout.conf.j2", dest: "timeout.conf" } - - { src: "systemd.without-privatedevices.conf.j2", dest: "without-privatedevices.conf" } - notify: - - Manage LB - - Reload the systemd daemon - - Restart all mysql - - name: remove default mysql_safe_syslog file: path: "/etc/mysql/conf.d/mysqld_safe_syslog.cnf"