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:
+64
-32
@@ -1,5 +1,6 @@
|
||||
---
|
||||
- import_tasks: show.yml
|
||||
- name: (main.yml) Import show.yml tasks
|
||||
ansible.builtin.import_tasks: show.yml
|
||||
tags:
|
||||
- show
|
||||
|
||||
@@ -8,7 +9,8 @@
|
||||
# timezone
|
||||
# locales
|
||||
# systemd-nofiles
|
||||
- import_tasks: basic.yml
|
||||
- name: (main.yml) Import basic.yml tasks
|
||||
ansible.builtin.import_tasks: basic.yml
|
||||
tags:
|
||||
- basic
|
||||
|
||||
@@ -27,7 +29,8 @@
|
||||
# apt-remove
|
||||
# apt-autoremove
|
||||
# apt-clean
|
||||
- import_tasks: apt.yml
|
||||
- name: (main.yml) Import apt.yml tasks
|
||||
ansible.builtin.import_tasks: apt.yml
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags: apt
|
||||
@@ -35,7 +38,8 @@
|
||||
# tags supported inside extrepo.yml
|
||||
#
|
||||
# extrepo
|
||||
- import_tasks: extrepo.yml
|
||||
- name: (main.yml) Import extrepo.yml tasks
|
||||
ansible.builtin.import_tasks: extrepo.yml
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
- (ansible_facts['distribution_major_version'] | int) >= 12
|
||||
@@ -45,7 +49,8 @@
|
||||
# tags supported inside apt-gateway.yml:
|
||||
#
|
||||
#
|
||||
- import_tasks: apt-gateway.yml
|
||||
- name: (main.yml) Import apt-gateway.yml tasks
|
||||
ansible.builtin.import_tasks: apt-gateway.yml
|
||||
when: inventory_hostname in groups['gateway_server']
|
||||
tags:
|
||||
- apt
|
||||
@@ -55,7 +60,8 @@
|
||||
# yum-update
|
||||
# yum-base-install
|
||||
# yum-initial-install
|
||||
- import_tasks: yum.yml
|
||||
- name: (main.yml) Import yum.yml tasks
|
||||
ansible.builtin.import_tasks: yum.yml
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
- ansible_facts.distribution == "CentOS" or ansible_facts.distribution == "Fedora"
|
||||
@@ -66,14 +72,16 @@
|
||||
# apt-caching-nameserver
|
||||
# yum-caching-nameserver
|
||||
#
|
||||
- import_tasks: caching-nameserver.yml
|
||||
- name: (main.yml) Import caching-nameserver.yml tasks
|
||||
ansible.builtin.import_tasks: caching-nameserver.yml
|
||||
when: groups['caching_nameserver']|string is search(inventory_hostname)
|
||||
tags: caching-nameserver
|
||||
|
||||
# tags supported inside systemd-resolved.yml
|
||||
#
|
||||
# systemd-resolved
|
||||
- import_tasks: systemd-resolved.yml
|
||||
- name: (main.yml) Import systemd-resolved.yml tasks
|
||||
ansible.builtin.import_tasks: systemd-resolved.yml
|
||||
tags:
|
||||
- systemd-resolved
|
||||
when:
|
||||
@@ -81,14 +89,16 @@
|
||||
- ansible_facts['distribution_major_version'] > "11"
|
||||
- systemd_resolved is defined and systemd_resolved|bool
|
||||
|
||||
- import_tasks: tor.yml
|
||||
- name: (main.yml) Import tor.yml tasks
|
||||
ansible.builtin.import_tasks: tor.yml
|
||||
when:
|
||||
- inventory_hostname in groups['mail_server']
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags:
|
||||
- tor-service
|
||||
|
||||
- import_tasks: cron.yml
|
||||
- name: (main.yml) Import cron.yml tasks
|
||||
ansible.builtin.import_tasks: cron.yml
|
||||
tags:
|
||||
- cron
|
||||
|
||||
@@ -97,7 +107,8 @@
|
||||
# vim-config
|
||||
# zsh-config
|
||||
#
|
||||
- import_tasks: shell.yml
|
||||
- name: (main.yml) Import shell.yml tasks
|
||||
ansible.builtin.import_tasks: shell.yml
|
||||
when:
|
||||
- ansible_facts['distribution'] == "Debian"
|
||||
tags:
|
||||
@@ -115,7 +126,8 @@
|
||||
# keypair-backup-server
|
||||
# root-defaut-ssh-keypair
|
||||
# insert_root_ssh_public_key
|
||||
- import_tasks: users.yml
|
||||
- name: (main.yml) Import users.yml tasks
|
||||
ansible.builtin.import_tasks: users.yml
|
||||
tags:
|
||||
- users
|
||||
|
||||
@@ -124,7 +136,8 @@
|
||||
# bash
|
||||
# profile
|
||||
# vim
|
||||
- import_tasks: users-systemfiles.yml
|
||||
- name: (main.yml) Import users-systemfiles.yml tasks
|
||||
ansible.builtin.import_tasks: users-systemfiles.yml
|
||||
tags:
|
||||
- users
|
||||
- users-systemfiles
|
||||
@@ -137,7 +150,8 @@
|
||||
# sudo-users
|
||||
# webadmin-defaut-ssh-keypair
|
||||
# insert_webadmin_ssh_public_key
|
||||
- import_tasks: webadmin-user.yml
|
||||
- name: (main.yml) Import webadmin-user.yml tasks
|
||||
ansible.builtin.import_tasks: webadmin-user.yml
|
||||
when: groups['webadmin']|string is search(inventory_hostname)
|
||||
tags:
|
||||
- users
|
||||
@@ -147,7 +161,8 @@
|
||||
# tags supported inside sshd.yml
|
||||
#
|
||||
# sshd-config
|
||||
- import_tasks: sshd.yml
|
||||
- name: (main.yml) Import sshd.yml tasks
|
||||
ansible.builtin.import_tasks: sshd.yml
|
||||
tags: sshd
|
||||
|
||||
# tags supported inside sudoers.yml:
|
||||
@@ -155,16 +170,19 @@
|
||||
# sudoers-remove
|
||||
# sudoers-file-configuration
|
||||
# sudoers-global-configuration
|
||||
- import_tasks: sudoers.yml
|
||||
- name: (main.yml) Import sudoers.yml tasks
|
||||
ansible.builtin.import_tasks: sudoers.yml
|
||||
tags: sudoers
|
||||
|
||||
- import_tasks: motd.yml
|
||||
- name: (main.yml) Import motd.yml tasks
|
||||
ansible.builtin.import_tasks: motd.yml
|
||||
tags: motd
|
||||
|
||||
# tags supported inside ntp.yml:
|
||||
#
|
||||
# ntp-server
|
||||
- import_tasks: ntp.yml
|
||||
- name: (main.yml) Import ntp.yml tasks
|
||||
ansible.builtin.import_tasks: ntp.yml
|
||||
tags:
|
||||
- ntp
|
||||
when:
|
||||
@@ -189,21 +207,24 @@
|
||||
# git-mailservers-repositories
|
||||
# git-sympa-repositories
|
||||
# git-other-repositories
|
||||
- import_tasks: git.yml
|
||||
- name: (main.yml) Import git.yml tasks
|
||||
ansible.builtin.import_tasks: git.yml
|
||||
tags: git
|
||||
|
||||
# tags supported inside nfs.yml:
|
||||
#
|
||||
# nfs-server
|
||||
# nfs-client
|
||||
- import_tasks: nfs.yml
|
||||
- name: (main.yml) Import nfs.yml tasks
|
||||
ansible.builtin.import_tasks: nfs.yml
|
||||
tags:
|
||||
- nfs
|
||||
|
||||
# tags supported inside x2go-server.yml:
|
||||
#
|
||||
# x2go-server
|
||||
- import_tasks: x2go-server.yml
|
||||
- name: (main.yml) Import x2go-server.yml tasks
|
||||
ansible.builtin.import_tasks: x2go-server.yml
|
||||
when: inventory_hostname in groups['x2go_server']
|
||||
tags:
|
||||
- x2go
|
||||
@@ -213,20 +234,23 @@
|
||||
# copy-files
|
||||
# copy-plain-files
|
||||
# copy-template-files
|
||||
- import_tasks: copy_files.yml
|
||||
- name: (main.yml) Import copy_files.yml tasks
|
||||
ansible.builtin.import_tasks: copy_files.yml
|
||||
tags:
|
||||
- copy-files
|
||||
|
||||
# tags supported inside symlink_files.yml:
|
||||
#
|
||||
# symlink-files
|
||||
- import_tasks: symlink_files.yml
|
||||
- name: (main.yml) Import symlink_files.yml tasks
|
||||
ansible.builtin.import_tasks: symlink_files.yml
|
||||
tags:
|
||||
- symlink-files
|
||||
|
||||
# tags supported inside config_files_mailsystem_scripts.yml:
|
||||
#
|
||||
- import_tasks: config_files_mailsystem_scripts.yml
|
||||
- name: (main.yml) Import config_files_mailsystem_scripts.yml tasks
|
||||
ansible.builtin.import_tasks: config_files_mailsystem_scripts.yml
|
||||
tags:
|
||||
- config-files-mailsystem
|
||||
|
||||
@@ -236,7 +260,8 @@
|
||||
# samba-user
|
||||
# system-user
|
||||
#
|
||||
- import_tasks: samba-user.yml
|
||||
- name: (main.yml) Import samba-user.yml tasks
|
||||
ansible.builtin.import_tasks: samba-user.yml
|
||||
when: inventory_hostname in groups['samba_server']
|
||||
tags:
|
||||
- samba-server
|
||||
@@ -248,7 +273,8 @@
|
||||
# samba-server
|
||||
# samba-cron
|
||||
#
|
||||
- import_tasks: samba-config-server.yml
|
||||
- name: (main.yml) Import samba-config-server.yml tasks
|
||||
ansible.builtin.import_tasks: samba-config-server.yml
|
||||
when: inventory_hostname in groups['samba_server']
|
||||
tags:
|
||||
- samba-server
|
||||
@@ -259,37 +285,43 @@
|
||||
# samba-user
|
||||
# system-user
|
||||
#
|
||||
- import_tasks: samba-remove-user.yml
|
||||
- name: (main.yml) Import samba-remove-user.yml tasks
|
||||
ansible.builtin.import_tasks: samba-remove-user.yml
|
||||
when: inventory_hostname in groups['samba_server']
|
||||
tags:
|
||||
- samba-server
|
||||
- remove-samba-user
|
||||
|
||||
- import_tasks: redis-server.yml
|
||||
- name: (main.yml) Import redis-server.yml tasks
|
||||
ansible.builtin.import_tasks: redis-server.yml
|
||||
when: inventory_hostname in groups['nextcloud_server'] or
|
||||
inventory_hostname in groups['apache2_webserver'] or
|
||||
inventory_hostname in groups['nginx_webserver']
|
||||
tags:
|
||||
- redis-server
|
||||
|
||||
- import_tasks: mysql.yml
|
||||
- name: (main.yml) Import mysql.yml tasks
|
||||
ansible.builtin.import_tasks: mysql.yml
|
||||
when: groups['mysql_server']|string is search(inventory_hostname)
|
||||
tags:
|
||||
- mysql
|
||||
- mariadb
|
||||
|
||||
- import_tasks: apache2.yml
|
||||
- name: (main.yml) Import apache2.yml tasks
|
||||
ansible.builtin.import_tasks: apache2.yml
|
||||
when: groups['apache2_webserver']|string is search(inventory_hostname)
|
||||
tags:
|
||||
- apache2
|
||||
|
||||
- import_tasks: systemd-services_debian_based_OS.yml
|
||||
- name: (main.yml) Import systemd-services_debian_based_OS.yml tasks
|
||||
ansible.builtin.import_tasks: systemd-services_debian_based_OS.yml
|
||||
when:
|
||||
- ansible_facts.os_family == "Debian"
|
||||
tags:
|
||||
- services
|
||||
|
||||
- import_tasks: systemd-services_redhat_based_OS.yml
|
||||
- name: (main.yml) Import systemd-services_redhat_based_OS.yml tasks
|
||||
ansible.builtin.import_tasks: systemd-services_redhat_based_OS.yml
|
||||
when:
|
||||
- ansible_facts.os_family == "RedHat"
|
||||
tags:
|
||||
|
||||
Reference in New Issue
Block a user