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 - fix: remove default value for mariadb_password
- test: replace kitchen to molecule - test: replace kitchen to molecule
- chore: use FQCN for module name
## [v2.0.0] - 2019-06-05 ## [v2.0.0] - 2019-06-05

View file

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

View file

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

View file

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

View file

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