ansible-playbooks/mysql/pkg.ansible.yml

28 lines
No EOL
757 B
YAML

- hosts: localhost
tasks:
- name: Install mariadb package
package:
state: present
name:
- mariadb
- mariadb-client
- mariadb-openrc
- name: Update MariaDB root password
mysql_user: name=root host={{item}} password={{mysql_root_password}}
with_items:
- 127.0.0.1
- ::1
- localhost
- name: Delete anonymous MySQL user
mysql_user: name="" host={{item}} state=absent
with_items:
- localhost
- "{{ansible_nodename}}"
- name: Delete Hostname based MySQL user
mysql_user: name=root host="{{ansible_nodename}}" state=absent
- name: Remove MySQL test database
mysql_db:
name: test
state: absent