chore: use FQCN for module name

This commit is contained in:
Adrien Waksberg 2021-08-22 16:09:18 +02:00 committed by Adrien Waksberg
parent 611d8234ad
commit 837a6cce63
5 changed files with 19 additions and 20 deletions

View file

@ -15,6 +15,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
- fix: remove default value for mariadb_password
- test: replace kitchen to molecule
- chore: use FQCN for module name
## [v2.0.0] - 2019-06-05

View file

@ -1,6 +1,6 @@
---
- name: restart mariadb
service:
ansible.builtin.service:
name: mysql
state: restarted
when: mariadb_autorestart|bool

View file

@ -1,6 +1,6 @@
---
- name: create the data directory
file:
ansible.builtin.file:
path: '{{ mariadb_full_config.mysqld.datadir }}'
owner: '{{ mariadb_full_config.mysqld.user }}'
group: root
@ -9,7 +9,7 @@
tags: mariadb
- name: initialize database
command:
ansible.builtin.command:
args:
argv:
- mysql_install_db
@ -21,23 +21,23 @@
tags: mariadb
- name: start mariadb
systemd:
ansible.builtin.service:
name: mysql
state: started
tags: mariadb
- name: wait mysql start
pause:
ansible.builtin.pause:
seconds: 5
tags: mariadb
- name: set root password
command: 'mysqladmin -u root password {{ mariadb_password }}'
ansible.builtin.command: 'mysqladmin -u root password {{ mariadb_password }}'
when: True
tags: mariadb
- name: remove anonymous users
mysql_user:
community.mysql.mysql_user:
name: ''
host_all: yes
state: absent
@ -47,7 +47,7 @@
tags: mariadb
- name: remove root user without password
mysql_user:
community.mysql.mysql_user:
name: root
host: '{{ item }}'
state: absent

View file

@ -3,10 +3,8 @@
when: mariadb_use_official_repository|bool
- name: install package
package:
name: '{{ packages }}'
vars:
packages:
ansible.builtin.package:
name:
- mariadb-server
- python-mysqldb
- python3-mysqldb
@ -16,7 +14,7 @@
tags: mariadb
- name: copy configuration file
template:
ansible.builtin.template:
src: my.cnf.j2
dest: /etc/mysql/my.cnf
owner: root
@ -26,7 +24,7 @@
tags: mariadb
- name: check if datadir exist
stat:
ansible.builtin.stat:
path: '{{ mariadb_full_config.mysqld.datadir }}'
register: st
tags: mariadb
@ -35,14 +33,14 @@
when: not st.stat.exists
- name: enable and start the service
service:
ansible.builtin.service:
name: mysql
state: started
enabled: yes
enabled: true
tags: mariadb
- name: manage users
mysql_user:
community.mysql.mysql_user:
name: '{{ item.name }}'
host: '{{ item.host }}'
password: '{{ item.password }}'
@ -57,7 +55,7 @@
tags: mariadb
- name: manage databases
mysql_db:
community.mysql.mysql_db:
name: '{{ item.name }}'
state: '{{ item.state|default("present") }}'
login_user: '{{ mariadb_user }}'

View file

@ -1,6 +1,6 @@
---
- name: add gpg key for mariadb repository
apt_key:
ansible.builtin.apt_key:
keyserver: '{{ mariadb_repository_key_server }}'
id: '{{ mariadb_repository_key_id }}'
retries: 2
@ -9,6 +9,6 @@
tags: mariadb
- name: add official repo
apt_repository:
ansible.builtin.apt_repository:
repo: '{{ mariadb_repository }}'
tags: mariadb