Skip to content

Commit

Permalink
Initialize Custom Data Directory
Browse files Browse the repository at this point in the history
Partially Fixes #510

This will create the expected data directory. This most likely does not
address protections in place because of AppArmor on Ubuntu
  • Loading branch information
misilot committed Feb 23, 2023
1 parent e322340 commit e25b692
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
- mysql_log_error | default(false)
tags: ['skip_ansible_galaxy']

- name: Initialize mysql when mysql_datadir is customized
ansible.builtin.command: mysqld --initialize-insecure --user=mysql --datadir={{ mysql_datadir }}
args:
creates: "{{ mysql_datadir }}/mysql"
when: mysql_datadir != "/var/lib/mysql"

- name: Ensure MySQL is started and enabled on boot.
ansible.builtin.service:
name: "{{ mysql_daemon }}"
Expand Down

0 comments on commit e25b692

Please sign in to comment.