Refactor Ansible tasks to use fully qualified module names and improve code consistency
- Updated all tasks to use fully qualified module names (e.g., ansible.builtin.shell, ansible.builtin.copy) for clarity and to avoid ambiguity. - Replaced deprecated 'yum' module with 'dnf' for package management on RedHat-based systems. - Improved formatting and consistency in task definitions, including the use of double quotes for strings and consistent indentation. - Removed unnecessary comments and whitespace to enhance readability. - Ensured that conditions and loops are consistently formatted across all tasks.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
---
|
||||
|
||||
# ---
|
||||
# MySQL / MariaDB Server
|
||||
# ---
|
||||
@@ -7,31 +6,28 @@
|
||||
- name: Populate service facts
|
||||
ansible.builtin.service_facts:
|
||||
|
||||
#- name: Print service facts
|
||||
# - name: Print service facts
|
||||
# ansible.builtin.debug:
|
||||
# var: ansible_facts.services
|
||||
# when:
|
||||
# - ansible_facts['services']['mariadb.service']['name'] | default('not-found') != 'not-found'
|
||||
|
||||
|
||||
- name: (mysql.yml) Ensure directory '/etc/systemd/system/mariadb.service.d' is present
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/mariadb.service.d
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
mode: "0755"
|
||||
when:
|
||||
- ansible_facts['services']['mariadb.service']['name'] | default('not-found') != 'not-found'
|
||||
|
||||
|
||||
- name: (mysql.yml) Ensure file '/etc/systemd/system/mariadb.service.d/limits.conf' exists
|
||||
copy:
|
||||
src: 'etc/systemd/system/mariadb.service.d/limits.conf'
|
||||
dest: '/etc/systemd/system/mariadb.service.d/limits.conf'
|
||||
ansible.builtin.copy:
|
||||
src: "etc/systemd/system/mariadb.service.d/limits.conf"
|
||||
dest: "/etc/systemd/system/mariadb.service.d/limits.conf"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
notify: "Restart mariadb"
|
||||
when:
|
||||
- ansible_facts['services']['mariadb.service']['name'] | default('not-found') != 'not-found'
|
||||
|
||||
Reference in New Issue
Block a user