1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00
infrastructure/roles/mariadb/tasks/main.yml
Evangelos Foutras 578b781966
Capitalize the handler name in handler invocations
Fixes: 26f289b72bfb ("Capitalize the first letter of all task names")
2022-08-29 21:46:39 +03:00

40 lines
1.1 KiB
YAML

- name: Install mariadb
pacman: name=mariadb,python-mysqlclient state=present
- name: Initialize mariadb
command: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
args:
creates: /var/lib/mysql/mysql
- name: Configure mariadb
template: src=server.cnf.j2 dest=/etc/my.cnf.d/server.cnf owner=root group=root mode=0644
notify:
- Restart mariadb
- name: Start and enable the service
service: name=mariadb state=started enabled=yes
- name: Delete anonymous users
mysql_user: user='' host_all=yes state='absent'
- name: Disallow remote root login
command: 'mysql -NBe "{{ item }}"'
with_items:
- DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
changed_when: false
- name: Drop test database
mysql_db: db=test state=absent
- name: Set root password
mysql_user: user=root host={{ item }} password={{ vault_mariadb_users.root }}
with_items:
- '127.0.0.1'
- '::1'
- 'localhost'
no_log: true
- name: Create client configuration for root
template: src=client.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0644
no_log: true