Skip to content

Commit 282f03d

Browse files
committed
Address fqcn linter rule
Related: https://ansible-lint.readthedocs.io/rules/fqcn/
1 parent ddd9c29 commit 282f03d

File tree

9 files changed

+51
-51
lines changed

9 files changed

+51
-51
lines changed

handlers/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: restart mysql
3-
service:
3+
ansible.builtin.service:
44
name: "{{ mysql_daemon }}"
55
state: restarted
66
sleep: 5

molecule/default/converge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
post_tasks:
1010
- name: Make sure we can connect to MySQL via Unix socket.
11-
command: "mysql -u root -proot -e 'show databases;'"
11+
ansible.builtin.command: "mysql -u root -proot -e 'show databases;'"
1212
changed_when: false
1313

1414
- name: Make sure we can connect to MySQL via TCP.
15-
command: "mysql -u root -proot -h 127.0.0.1 -e 'show databases;'"
15+
ansible.builtin.command: "mysql -u root -proot -h 127.0.0.1 -e 'show databases;'"
1616
changed_when: false

tasks/configure.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
- name: Get MySQL version.
3-
command: 'mysql --version'
3+
ansible.builtin.command: 'mysql --version'
44
register: mysql_cli_version
55
changed_when: false
66
check_mode: false
77

88
- name: Copy my.cnf global MySQL configuration.
9-
template:
9+
ansible.builtin.template:
1010
src: my.cnf.j2
1111
dest: "{{ mysql_config_file }}"
1212
owner: root
@@ -16,7 +16,7 @@
1616
notify: restart mysql
1717

1818
- name: Verify mysql include directory exists.
19-
file:
19+
ansible.builtin.file:
2020
path: "{{ mysql_config_include_dir }}"
2121
state: directory
2222
owner: root
@@ -25,7 +25,7 @@
2525
when: mysql_config_include_files | length
2626

2727
- name: Copy my.cnf override files into include directory.
28-
template:
28+
ansible.builtin.template:
2929
src: "{{ item.src }}"
3030
dest: "{{ mysql_config_include_dir }}/{{ item.src | basename }}"
3131
owner: root
@@ -36,13 +36,13 @@
3636
notify: restart mysql
3737

3838
- name: Create slow query log file (if configured).
39-
command: "touch {{ mysql_slow_query_log_file }}"
39+
ansible.builtin.command: "touch {{ mysql_slow_query_log_file }}"
4040
args:
4141
creates: "{{ mysql_slow_query_log_file }}"
4242
when: mysql_slow_query_log_enabled
4343

4444
- name: Create datadir if it does not exist
45-
file:
45+
ansible.builtin.file:
4646
path: "{{ mysql_datadir }}"
4747
state: directory
4848
owner: mysql
@@ -51,7 +51,7 @@
5151
setype: mysqld_db_t
5252

5353
- name: Set ownership on slow query log file (if configured).
54-
file:
54+
ansible.builtin.file:
5555
path: "{{ mysql_slow_query_log_file }}"
5656
state: file
5757
owner: mysql
@@ -60,7 +60,7 @@
6060
when: mysql_slow_query_log_enabled
6161

6262
- name: Create error log file (if configured).
63-
command: "touch {{ mysql_log_error }}"
63+
ansible.builtin.command: "touch {{ mysql_log_error }}"
6464
args:
6565
creates: "{{ mysql_log_error }}"
6666
when:
@@ -69,7 +69,7 @@
6969
tags: ['skip_ansible_galaxy']
7070

7171
- name: Set ownership on error log file (if configured).
72-
file:
72+
ansible.builtin.file:
7373
path: "{{ mysql_log_error }}"
7474
state: file
7575
owner: mysql
@@ -81,7 +81,7 @@
8181
tags: ['skip_ansible_galaxy']
8282

8383
- name: Ensure MySQL is started and enabled on boot.
84-
service:
84+
ansible.builtin.service:
8585
name: "{{ mysql_daemon }}"
8686
state: started
8787
enabled: "{{ mysql_enabled_on_startup }}"

tasks/main.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
---
22
# Variable configuration.
3-
- include_tasks: variables.yml
3+
- ansible.builtin.include_tasks: variables.yml
44

55
# Setup/install tasks.
6-
- include_tasks: setup-RedHat.yml
6+
- ansible.builtin.include_tasks: setup-RedHat.yml
77
when: ansible_os_family == 'RedHat'
88

9-
- include_tasks: setup-Debian.yml
9+
- ansible.builtin.include_tasks: setup-Debian.yml
1010
when: ansible_os_family == 'Debian'
1111

12-
- include_tasks: setup-Archlinux.yml
12+
- ansible.builtin.include_tasks: setup-Archlinux.yml
1313
when: ansible_os_family == 'Archlinux'
1414

1515
- name: Check if MySQL packages were installed.
16-
set_fact:
16+
ansible.builtin.set_fact:
1717
mysql_install_packages: "{{ (rh_mysql_install_packages is defined and rh_mysql_install_packages.changed)
1818
or (deb_mysql_install_packages is defined and deb_mysql_install_packages.changed)
1919
or (arch_mysql_install_packages is defined and arch_mysql_install_packages.changed) }}"
2020

2121
# Configure MySQL.
22-
- include_tasks: configure.yml
23-
- include_tasks: secure-installation.yml
24-
- include_tasks: databases.yml
25-
- include_tasks: users.yml
26-
- include_tasks: replication.yml
22+
- ansible.builtin.include_tasks: configure.yml
23+
- ansible.builtin.include_tasks: secure-installation.yml
24+
- ansible.builtin.include_tasks: databases.yml
25+
- ansible.builtin.include_tasks: users.yml
26+
- ansible.builtin.include_tasks: replication.yml

tasks/secure-installation.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Has to be after the password assignment, for idempotency.
1212
- name: Copy user-my.cnf file with password credentials.
13-
template:
13+
ansible.builtin.template:
1414
src: "user-my.cnf.j2"
1515
dest: "{{ mysql_user_home }}/.my.cnf"
1616
owner: "{{ mysql_user_name }}"
@@ -20,13 +20,13 @@
2020
and (mysql_install_packages | bool or mysql_user_password_update)
2121
2222
- name: Disallow root login remotely
23-
command: 'mysql -NBe "{{ item }}"'
23+
ansible.builtin.command: 'mysql -NBe "{{ item }}"'
2424
with_items:
2525
- DELETE FROM mysql.user WHERE User='{{ mysql_root_username }}' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
2626
changed_when: false
2727

2828
- name: Get list of hosts for the root user.
29-
command: mysql -NBe
29+
ansible.builtin.command: mysql -NBe
3030
"SELECT Host
3131
FROM mysql.user
3232
WHERE User = '{{ mysql_root_username }}'
@@ -40,7 +40,7 @@
4040
# the root password correctly. See: https://goo.gl/MSOejW
4141
# Set root password for MySQL >= 5.7.x.
4242
- name: Update MySQL root password for localhost root account (5.7.x).
43-
shell: >
43+
ansible.builtin.shell: >
4444
mysql -u root -NBe
4545
"ALTER USER '{{ mysql_root_username }}'@'{{ item }}'
4646
IDENTIFIED WITH mysql_native_password BY '{{ mysql_root_password }}'; FLUSH PRIVILEGES;"
@@ -51,7 +51,7 @@
5151
5252
# Set root password for MySQL < 5.7.x.
5353
- name: Update MySQL root password for localhost root account (< 5.7.x).
54-
shell: >
54+
ansible.builtin.shell: >
5555
mysql -NBe
5656
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}"); FLUSH PRIVILEGES;'
5757
with_items: "{{ mysql_root_hosts.stdout_lines|default([]) }}"
@@ -61,7 +61,7 @@
6161
6262
# Has to be after the root password assignment, for idempotency.
6363
- name: Copy .my.cnf file with root password credentials.
64-
template:
64+
ansible.builtin.template:
6565
src: "root-my.cnf.j2"
6666
dest: "{{ mysql_root_home }}/.my.cnf"
6767
owner: root
@@ -70,7 +70,7 @@
7070
when: mysql_install_packages | bool or mysql_root_password_update
7171

7272
- name: Get list of hosts for the anonymous user.
73-
command: mysql -NBe "SELECT Host FROM mysql.user WHERE User = ''"
73+
ansible.builtin.command: mysql -NBe "SELECT Host FROM mysql.user WHERE User = ''"
7474
register: mysql_anonymous_hosts
7575
changed_when: false
7676
check_mode: false

tasks/setup-Archlinux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
- name: Ensure MySQL Python libraries are installed.
3-
pacman: "name=mysql-python state=present"
3+
community.general.pacman: "name=mysql-python state=present"
44

55
- name: Ensure MySQL packages are installed.
6-
pacman: "name={{ mysql_packages }} state=present"
6+
community.general.pacman: "name={{ mysql_packages }} state=present"
77
register: arch_mysql_install_packages
88

99
- name: Run mysql_install_db if MySQL packages were changed.
10-
command: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
10+
ansible.builtin.command: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
1111
when: arch_mysql_install_packages.changed
1212
tags: ['skip_ansible_lint']

tasks/setup-Debian.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
- name: Check if MySQL is already installed.
3-
stat:
3+
ansible.builtin.stat:
44
path: "{{ mysql_config_file }}"
55
register: mysql_installed
66

77
- name: Update apt cache if MySQL is not yet installed.
8-
apt: update_cache=yes
8+
ansible.builtin.apt: update_cache=yes
99
changed_when: False
1010
when: not mysql_installed.stat.exists
1111

1212
- name: Ensure MySQL Python libraries are installed.
13-
apt:
13+
ansible.builtin.apt:
1414
name: "{{ mysql_python_package_debian }}"
1515
state: present
1616

1717
- name: Ensure MySQL packages are installed.
18-
apt:
18+
ansible.builtin.apt:
1919
name: "{{ mysql_packages }}"
2020
state: present
2121
policy_rc_d: 101
@@ -24,11 +24,11 @@
2424
# Because Ubuntu starts MySQL as part of the install process, we need to stop
2525
# mysql and remove the logfiles in case the user set a custom log file size.
2626
- name: Ensure MySQL is stopped after initial install.
27-
service: "name={{ mysql_daemon }} state=stopped"
27+
ansible.builtin.service: "name={{ mysql_daemon }} state=stopped"
2828
when: not mysql_installed.stat.exists
2929

3030
- name: Delete innodb log files created by apt package after initial install.
31-
file:
31+
ansible.builtin.file:
3232
path: "{{ mysql_datadir }}/{{ item }}"
3333
state: absent
3434
with_items:

tasks/setup-RedHat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Ensure MySQL packages are installed.
3-
yum:
3+
ansible.builtin.yum:
44
name: "{{ mysql_packages }}"
55
state: present
66
enablerepo: "{{ mysql_enablerepo | default(omit, true) }}"

tasks/variables.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
---
22
# Variable configuration.
33
- name: Include OS-specific variables.
4-
include_vars: "{{ item }}"
4+
ansible.builtin.include_vars: "{{ item }}"
55
with_first_found:
66
- files:
77
- "vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
88
- "vars/{{ ansible_os_family }}.yml"
99
skip: true
1010

1111
- name: Define mysql_packages.
12-
set_fact:
12+
ansible.builtin.set_fact:
1313
mysql_packages: "{{ __mysql_packages | list }}"
1414
when: mysql_packages is not defined
1515

1616
- name: Define mysql_daemon.
17-
set_fact:
17+
ansible.builtin.set_fact:
1818
mysql_daemon: "{{ __mysql_daemon }}"
1919
when: mysql_daemon is not defined
2020

2121
- name: Define mysql_slow_query_log_file.
22-
set_fact:
22+
ansible.builtin.set_fact:
2323
mysql_slow_query_log_file: "{{ __mysql_slow_query_log_file }}"
2424
when: mysql_slow_query_log_file is not defined
2525

2626
- name: Define mysql_log_error.
27-
set_fact:
27+
ansible.builtin.set_fact:
2828
mysql_log_error: "{{ __mysql_log_error }}"
2929
when: mysql_log_error is not defined
3030

3131
- name: Define mysql_syslog_tag.
32-
set_fact:
32+
ansible.builtin.set_fact:
3333
mysql_syslog_tag: "{{ __mysql_syslog_tag }}"
3434
when: mysql_syslog_tag is not defined
3535

3636
- name: Define mysql_pid_file.
37-
set_fact:
37+
ansible.builtin.set_fact:
3838
mysql_pid_file: "{{ __mysql_pid_file }}"
3939
when: mysql_pid_file is not defined
4040

4141
- name: Define mysql_config_file.
42-
set_fact:
42+
ansible.builtin.set_fact:
4343
mysql_config_file: "{{ __mysql_config_file }}"
4444
when: mysql_config_file is not defined
4545

4646
- name: Define mysql_config_include_dir.
47-
set_fact:
47+
ansible.builtin.set_fact:
4848
mysql_config_include_dir: "{{ __mysql_config_include_dir }}"
4949
when: mysql_config_include_dir is not defined
5050

5151
- name: Define mysql_socket.
52-
set_fact:
52+
ansible.builtin.set_fact:
5353
mysql_socket: "{{ __mysql_socket }}"
5454
when: mysql_socket is not defined
5555

5656
- name: Define mysql_supports_innodb_large_prefix.
57-
set_fact:
57+
ansible.builtin.set_fact:
5858
mysql_supports_innodb_large_prefix: "{{ __mysql_supports_innodb_large_prefix }}"
5959
when: mysql_supports_innodb_large_prefix is not defined

0 commit comments

Comments
 (0)