Feat: mysql user creation done

This commit is contained in:
Bertrand Benjamin 2020-09-25 07:02:45 +02:00
parent 67626a455b
commit d91a5e97fd

View File

@ -22,3 +22,21 @@
dest: "/home/{{ item.name }}/public_html/index.html" dest: "/home/{{ item.name }}/public_html/index.html"
mode: 774 mode: 774
with_items: "{{ users }}" with_items: "{{ users }}"
- name: create database
mysql_db:
db: "{{ item.name }}"
state: present
login_user: root
login_password: "{{ mysql_root_password }}"
with_items: "{{ users }}"
- name: create db user
mysql_user:
user: "{{ item.name }}"
password: "{{ lookup('password', './pass/' + item.name + '_sql length=10 chars=ascii_letters') | password_hash('sha512') }}"
priv: "{{ item.name + '.*:ALL,GRANT' }}"
login_user: root
login_password: "{{ mysql_root_password }}"
state: present
with_items: "{{ users }}"