mysql: use /etc/mysql/debian.cnf for configuration

This commit is contained in:
Jérémy Lecour 2017-06-12 15:11:05 +02:00 committed by Jérémy Lecour
parent 65f91f09b0
commit 0481c51a40

View file

@ -23,22 +23,11 @@
priv: "*.*:ALL,GRANT" priv: "*.*:ALL,GRANT"
update_password: on_create update_password: on_create
state: present state: present
config_file: "/etc/mysql/debian.cnf"
register: create_mysqladmin_user register: create_mysqladmin_user
tags: tags:
- mysql - mysql
# Ansible 2.2 allows to create with ini_file
# before: we have to create the file beforehand
- name: touch /root/.my.cnf
file:
path: /root/.my.cnf
state: touch
changed_when: False
when: create_mysqladmin_user.changed
tags:
- mysql
- name: mysqladmin is the default user - name: mysqladmin is the default user
ini_file: ini_file:
dest: /root/.my.cnf dest: /root/.my.cnf
@ -46,6 +35,7 @@
section: client section: client
option: '{{ item.option }}' option: '{{ item.option }}'
value: '{{ item.value }}' value: '{{ item.value }}'
create: yes
with_items: with_items:
- { option: 'user', value: 'mysqladmin' } - { option: 'user', value: 'mysqladmin' }
- { option: password, value: '{{ mysql_admin_password.stdout }}' } - { option: password, value: '{{ mysql_admin_password.stdout }}' }
@ -58,7 +48,7 @@
name: root name: root
#host_all: yes #host_all: yes
host: "{{ item }}" host: "{{ item }}"
config_file: /root/.my.cnf config_file: "/etc/mysql/debian.cnf"
state: absent state: absent
with_items: with_items:
- "localhost" - "localhost"