Commit c9fbef8b authored by Chris Croome's avatar Chris Croome

Use handler to restart and inc jessie upgrade task

parent 964760c3
Pipeline #12650 failed with stage
in 24 seconds
---
image: registry.git.coop/webarch/containers/images/ansible:0.3
image: registry.git.coop/webarch/containers/images/ansible:0.4
stages:
- check
......
---
- name: MariaDB restarted
systemd:
name: mysql
state: restarted
daemon_reload: true
listen: Restart mariadb
tags:
- mariadb
...
......@@ -18,7 +18,7 @@
src: templates/50-server.cnf.j2
dest: /etc/mysql/mariadb.conf.d/50-server.cnf
backup: true
register: mariadb_conf
notify: Restart mariadb
tags:
- mariadb
......@@ -33,16 +33,20 @@
template:
src: templates/mariadb.conf.j2
dest: /etc/systemd/system/mariadb.service.d/mariadb.conf
register: mariadb_systemd
notify: Restart mariadb
tags:
- mariadb
- name: MariaDB restarted
systemd:
name: mysql
state: restarted
daemon_reload: true
when: ( mariadb_conf.changed ) or ( mariadb_systemd.changed )
- name: Stat /etc/mysql/my.cnf
stat:
path: /etc/mysql/my.cnf
register: mariadb_etc_my_cnf
tags:
- mariadb
- name: Conditionally include the update-alternatives tasks
include_tasks: update.yml
when: ( mariadb_etc_my_cnf is defined ) and ( not mariadb_etc_my_cnf.stat.islnk )
tags:
- mariadb
......
......@@ -19,7 +19,7 @@
- name: Load the passwd from /root/.my.cnf
command: "my_print_defaults --defaults-file='/root/.my.cnf' client"
register: mariadb_my_print_defaults_command
# no_log: true
no_log: true
- name: Set a fact for the mariadb_root_password
set_fact:
......@@ -28,7 +28,7 @@
loop: "{{ mariadb_my_print_defaults_command.stdout_lines }}"
loop_control:
loop_var: line
# no_log: true
no_log: true
when: root_mycnf_stat.stat.exists == True
tags:
......
......@@ -8,12 +8,12 @@
- name: Generate a random password for MariaDB root
command: pwgen -n 20 1
register: mariadb_root_password_gen
# no_log: true
no_log: true
- name: Set a fact for the mariadb_root_password
set_fact:
mariadb_root_password: "{{ mariadb_root_password_gen.stdout | trim }}"
# no_log: true
no_log: true
when: root_mycnf_stat.stat.exists == False
tags:
......@@ -21,9 +21,8 @@
# https://www.percona.com/blog/2016/03/16/change-user-password-in-mysql-5-7-with-plugin-auth_socket/
- name: Enable MariaDB root logins with a password
#command: mysql -uroot -p{{ mariadb_root_password }} -e "UPDATE mysql.user SET authentication_string=PASSWORD('{{ mariadb_root_password }}'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost'; FLUSH PRIVILEGES;"
command: mysql -uroot -e "UPDATE mysql.user SET authentication_string=PASSWORD('{{ mariadb_root_password }}'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost'; FLUSH PRIVILEGES;"
# no_log: true
no_log: true
- name: MariaDB root password written to /root/.my.cnf
template:
......@@ -33,7 +32,7 @@
group: root
mode: 0400
force: true
# no_log: true
no_log: true
tags:
- mariadb
......
......@@ -48,6 +48,7 @@
- name: Import the time zone data from /usr/share/zoneinfo
shell: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql mysql
notify: Restart mariadb
- name: Update the /root/.my.tzdata file
shell: dpkg-parsechangelog -l /usr/share/doc/tzdata/changelog.Debian.gz -S Date > /root/.my.tzdata
......
---
- name: Upgrade from Debian Jessie MySQL configuration
command: update-alternatives --remove my.cnf /etc/mysql/my.cnf.migrated
notify: Restart mariadb
tags:
- mariadb
...
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment