Skip to content

Instantly share code, notes, and snippets.

@aderixon
Last active September 22, 2017 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aderixon/81130c7e4c56bedb87c4bb851a6d3c5b to your computer and use it in GitHub Desktop.
Save aderixon/81130c7e4c56bedb87c4bb851a6d3c5b to your computer and use it in GitHub Desktop.
Ansible MySQL 5.7 Community Edition install
# before starting mysqld:
- name: check for MySQL pre systemd script
stat:
path: /usr/bin/mysqld_pre_systemd
register: pre_systemd
# Monkey-patch MySQL pre-start systemd script to prevent it setting
# a random root password
# Don't hate me, blame Oracle
- name: patch MySQL initialisation
replace:
dest: /usr/bin/mysqld_pre_systemd
regexp: ' --initialize '
replace: ' --initialize-insecure '
backup: yes
when: pre_systemd.stat.exists
# now start mysqld service (and set a known root password!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment