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,31 +1,27 @@
|
||||
---
|
||||
|
||||
- name: (apt-gateway.yml) Install gateway related packages
|
||||
ansible.builtin.apt:
|
||||
name: "{{ apt_gateway_host_pkgs }}"
|
||||
state: "{{ apt_install_state }}"
|
||||
|
||||
|
||||
- name: (apt-gateway.yml) Check if file '/etc/logrotate.d/speedtest' exists
|
||||
ansible.builtin.stat:
|
||||
path: /etc/logrotate.d/speedtest
|
||||
register: common_logrotate_speedtest_exists
|
||||
|
||||
|
||||
- name: (apt-gateway.yml) Ensure file /etc/logrotate.d/speedtest exists
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path + '/files/etc/logrotate.d/speedtest' }}"
|
||||
dest: /etc/logrotate.d/speedtest
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
mode: "0644"
|
||||
when:
|
||||
- not common_logrotate_speedtest_exists.stat.exists
|
||||
|
||||
|
||||
- name: (apt-gateway.yml) Set crontab entry for nightly speedtests
|
||||
ansible.builtin.cron:
|
||||
name: 'Speedtest'
|
||||
name: "Speedtest"
|
||||
minute: 13
|
||||
hour: 0-8
|
||||
job: '/root/bin/admin-stuff/speedtest.sh'
|
||||
job: "/root/bin/admin-stuff/speedtest.sh"
|
||||
|
||||
Reference in New Issue
Block a user