From 3ba66fdba42c2c0563519e403e62f5cb8ede4799 Mon Sep 17 00:00:00 2001 From: Tommaso Piccioli Date: Mon, 18 Oct 2021 14:22:00 +0200 Subject: [PATCH] Update 'tasks/mysql-conf.yml' apparmor mod required on changing mysql data dir --- tasks/mysql-conf.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tasks/mysql-conf.yml b/tasks/mysql-conf.yml index 97dd3c1..6e85f57 100644 --- a/tasks/mysql-conf.yml +++ b/tasks/mysql-conf.yml @@ -32,7 +32,15 @@ with_items: - server notify: Restart mysql - + + - name: Add AppArmor alias + lineinfile: path=/etc/apparmor.d/tunables/alias line='alias /var/lib/mysql/ -> {{ mysql_data_dir }}/,' insertafter=EOF + when: my_data_dir.stat.isdir is not defined + + - name: Restart AppArmor service + service: name=apparmor state=restarted + when: my_data_dir.stat.isdir is not defined + - name: Start the mysql service with the new the data directory service: name=mysql state=started when: my_data_dir.stat.isdir is not defined