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 @@
|
||||
---
|
||||
|
||||
- name: Ensure util-linux-extra is installed on Debian
|
||||
ansible.builtin.apt:
|
||||
name: util-linux-extra
|
||||
@@ -15,7 +14,6 @@
|
||||
tags:
|
||||
- timezone
|
||||
|
||||
|
||||
- name: (basic.yml) Ensure locales are present
|
||||
community.general.locale_gen:
|
||||
name: "{{ item }}"
|
||||
@@ -36,7 +34,6 @@
|
||||
tags:
|
||||
- symlink-sh
|
||||
|
||||
|
||||
# ----------
|
||||
# security limit (maybe DEPRECATED see systemd settings)
|
||||
# ----------
|
||||
@@ -45,7 +42,7 @@
|
||||
ansible.builtin.file:
|
||||
path: /etc/security/limits.d
|
||||
state: directory
|
||||
mode: '0755'
|
||||
mode: "0755"
|
||||
group: root
|
||||
owner: root
|
||||
when:
|
||||
@@ -57,14 +54,14 @@
|
||||
|
||||
- name: (basic.yml) Ensure files /etc/security/limits.d/*.conf exists
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.src_path }}'
|
||||
dest: '{{ item.dest_path }}'
|
||||
src: "{{ item.src_path }}"
|
||||
dest: "{{ item.dest_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
loop: "{{ copy_plain_files_security_limits }}"
|
||||
loop_control:
|
||||
label: 'dest: {{ item.name }}'
|
||||
label: "dest: {{ item.name }}"
|
||||
when:
|
||||
- inventory_hostname not in groups['lxc_guest'] or inventory_hostname in groups['lxc_host'] or inventory_hostname in groups['oopen_office_server']
|
||||
- copy_plain_files_security_limits is defined
|
||||
@@ -72,7 +69,6 @@
|
||||
tags:
|
||||
- systemd-config
|
||||
|
||||
|
||||
# ----------
|
||||
# systemd stuff
|
||||
# ----------
|
||||
@@ -81,7 +77,7 @@
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system.conf.d
|
||||
state: directory
|
||||
mode: '0755'
|
||||
mode: "0755"
|
||||
group: root
|
||||
owner: root
|
||||
when:
|
||||
@@ -97,14 +93,14 @@
|
||||
|
||||
- name: (basic.yml) Ensure files /etc/systemd/system.conf.d/*.conf exists
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.src_path }}'
|
||||
dest: '{{ item.dest_path }}'
|
||||
src: "{{ item.src_path }}"
|
||||
dest: "{{ item.dest_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
loop: "{{ copy_plain_files_systemd }}"
|
||||
loop_control:
|
||||
label: 'dest: {{ item.name }}'
|
||||
label: "dest: {{ item.name }}"
|
||||
when:
|
||||
- >-
|
||||
inventory_hostname not in groups['lxc_guest'] or
|
||||
@@ -120,7 +116,7 @@
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/journald.conf.d
|
||||
state: directory
|
||||
mode: '0755'
|
||||
mode: "0755"
|
||||
group: root
|
||||
owner: root
|
||||
when:
|
||||
@@ -131,14 +127,14 @@
|
||||
|
||||
- name: (basic.yml) Ensure files /etc/systemd/journald.conf.d/*.conf exists
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.src_path }}'
|
||||
dest: '{{ item.dest_path }}'
|
||||
src: "{{ item.src_path }}"
|
||||
dest: "{{ item.dest_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
loop: "{{ copy_plain_files_journald }}"
|
||||
loop_control:
|
||||
label: 'dest: {{ item.name }}'
|
||||
label: "dest: {{ item.name }}"
|
||||
notify: "Restart systemd-journald"
|
||||
when:
|
||||
- copy_plain_files_journald is defined
|
||||
@@ -146,7 +142,6 @@
|
||||
tags:
|
||||
- systemd-config
|
||||
|
||||
|
||||
# ----------
|
||||
# kernel parameter
|
||||
# ----------
|
||||
@@ -155,7 +150,7 @@
|
||||
ansible.builtin.file:
|
||||
path: etc/sysctl.d
|
||||
state: directory
|
||||
mode: '0755'
|
||||
mode: "0755"
|
||||
group: root
|
||||
owner: root
|
||||
when:
|
||||
@@ -167,14 +162,14 @@
|
||||
|
||||
- name: (basic.yml) Ensure files /etc/sysctl.d/*.conf exists
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.src_path }}'
|
||||
dest: '{{ item.dest_path }}'
|
||||
src: "{{ item.src_path }}"
|
||||
dest: "{{ item.dest_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
loop: "{{ copy_plain_files_sysctl }}"
|
||||
loop_control:
|
||||
label: 'dest: {{ item.name }}'
|
||||
label: "dest: {{ item.name }}"
|
||||
when:
|
||||
- inventory_hostname not in groups['lxc_guest'] or inventory_hostname in groups['lxc_host'] or inventory_hostname in groups['oopen_office_server']
|
||||
- copy_plain_files_sysctl is defined
|
||||
@@ -184,14 +179,14 @@
|
||||
|
||||
- name: (basic.yml) Additional Kernel Parameters (files /etc/sysctl.d/*.conf)
|
||||
ansible.builtin.copy:
|
||||
src: '{{ item.src_path }}'
|
||||
dest: '{{ item.dest_path }}'
|
||||
src: "{{ item.src_path }}"
|
||||
dest: "{{ item.dest_path }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
loop: "{{ copy_additional_plain_files_sysctl }}"
|
||||
loop_control:
|
||||
label: 'dest: {{ item.name }}'
|
||||
label: "dest: {{ item.name }}"
|
||||
when:
|
||||
- inventory_hostname not in groups['lxc_guest'] or inventory_hostname in groups['lxc_host'] or inventory_hostname in groups['oopen_office_server']
|
||||
- copy_additional_plain_files_sysctl is defined
|
||||
@@ -199,7 +194,6 @@
|
||||
tags:
|
||||
- systctl-config
|
||||
|
||||
|
||||
# ----------
|
||||
# unattended upgrades
|
||||
# ----------
|
||||
@@ -246,7 +240,7 @@
|
||||
creates: /etc/apt/apt.conf.d/20auto-upgrades
|
||||
environment:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
DEBCONF_NONINTERACTIVE_SEEN: 'true'
|
||||
DEBCONF_NONINTERACTIVE_SEEN: "true"
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
- not common_ua_enabled.stat.exists
|
||||
@@ -259,7 +253,7 @@
|
||||
dest: /etc/apt/listchanges.conf
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags:
|
||||
@@ -272,7 +266,7 @@
|
||||
backup: true
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags:
|
||||
|
||||
Reference in New Issue
Block a user