diff --git a/roles/mysql/tasks/Ubuntu_18_mysql_server.yml b/roles/mysql/tasks/Ubuntu_18_mysql_server.yml index 1a1fbd4af3364eb99a43d13f96b40c372dc8141b..fdaf9afaea316de38635e4e51dc02876e18f9766 100644 --- a/roles/mysql/tasks/Ubuntu_18_mysql_server.yml +++ b/roles/mysql/tasks/Ubuntu_18_mysql_server.yml @@ -30,12 +30,18 @@ - name: "Adding user database" mysql_db: name={{ mysql_user_db_name }} state=present login_user=root login_password={{ mysql_root_password }} + become: true + become_user: root - name: "Giving priviliges to user" mysql_user: name={{ mysql_user_name }} host={{ mysql_user_host }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present when: mysql_user_host is defined + become: true + become_user: root - name: "Giving priviliges to user" mysql_user: name={{ mysql_user_name }} host={{ hostvars[item].ansible_fqdn }} password={{ mysql_user_password }} login_user=root login_password={{ mysql_root_password }} priv={{ mysql_user_db_name }}.*:ALL,GRANT state=present with_items: "{{ mysql_user_hosts_group }}" when: mysql_user_hosts_group is defined + become: true + become_user: root \ No newline at end of file