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:
+18
-25
@@ -1,10 +1,9 @@
|
||||
---
|
||||
|
||||
- name: (yum.yml) Install system updates for redhat (centos/fedora) systems
|
||||
yum:
|
||||
name: '*'
|
||||
ansible.builtin.dnf:
|
||||
name: "*"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
update_cache: true
|
||||
#cache_valid_time: 3600
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
@@ -12,19 +11,17 @@
|
||||
tags:
|
||||
- yum-update
|
||||
|
||||
|
||||
- name: Install the EPEL Repository in CentOS 7
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: epel-release
|
||||
state: latest
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
- ansible_facts.distribution == "CentOS"
|
||||
|
||||
|
||||
# Its more eficient to in
|
||||
- name: (yum.yml) Base install CentOS packages (CentOS 7)
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_base_install_centos_7 }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -35,7 +32,7 @@
|
||||
- yum-base-install
|
||||
|
||||
- name: (yum.yml) Initial install CentOS packages (CentOS 7)
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_initial_install_centos_7 }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -45,10 +42,9 @@
|
||||
tags:
|
||||
- yum-initial-install
|
||||
|
||||
|
||||
# Its more eficient to in
|
||||
- name: (yum.yml) Base install Fedira packages (Fedora 38)
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_base_install_fedora_38 }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -59,7 +55,7 @@
|
||||
- yum-base-install
|
||||
|
||||
- name: (yum.yml) Initial install Fedora packages (Fedora 38)
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_initial_install_fedora_38 }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -69,9 +65,8 @@
|
||||
tags:
|
||||
- yum-initial-install
|
||||
|
||||
|
||||
- name: (yum.yml) Install lxc_host related packages CentOS systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_lxc_host_pkgs_centos }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -82,7 +77,7 @@
|
||||
- yum-lxc-hosts-pkgs
|
||||
|
||||
- name: (yum.yml) Install lxc_host related packages Fedora systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_lxc_host_pkgs_fedora }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -92,9 +87,8 @@
|
||||
tags:
|
||||
- yum-lxc-hosts-pkgs
|
||||
|
||||
|
||||
- name: (yum.yml) Install postgresql server related packages CentOS systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_postgresql_pkgs_centos }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -105,7 +99,7 @@
|
||||
- apt-postgresql-server-pkgs
|
||||
|
||||
- name: (yum.yml) Install postgresql server related packages Fedora systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_postgresql_pkgs_fedora }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -115,9 +109,8 @@
|
||||
tags:
|
||||
- apt-postgresql-server-pkgs
|
||||
|
||||
|
||||
- name: (yum.yml) Install compile related packages CentOS systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_compiler_pkgs_centos }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -128,7 +121,7 @@
|
||||
- yum-compiler-pkgs
|
||||
|
||||
- name: (yum.yml) Install compile related packages Fedora systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_compiler_pkgs_fedora }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
@@ -139,10 +132,10 @@
|
||||
- yum-compiler-pkgs
|
||||
|
||||
- name: (yum.yml) Install webserver related packages CentOS systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_webserver_pkgs_centos }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
- ansible_facts.distribution == "CentOS"
|
||||
- install_webserver_pkgs|bool
|
||||
@@ -150,10 +143,10 @@
|
||||
- yum-webserver-pkgs
|
||||
|
||||
- name: (yum.yml) Install webserver related packages Fedora systems
|
||||
yum:
|
||||
ansible.builtin.dnf:
|
||||
name: "{{ yum_webserver_pkgs_fedora }}"
|
||||
state: "{{ yum_install_state }}"
|
||||
when:
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
- ansible_facts.distribution == "Fedora"
|
||||
- install_webserver_pkgs|bool
|
||||
|
||||
Reference in New Issue
Block a user