From 3d018fd1786326c598533ecc192603982c6565e9 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 7 Feb 2026 08:45:57 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactor=20tas?= =?UTF-8?q?k=20names=20and=20module=20references=20for=20clarity=20and=20c?= =?UTF-8?q?onsistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit refactors task names across multiple files to improve clarity and maintain consistency, ensuring that each task name accurately reflects its purpose and using the latest `ansible.builtin` modules where applicable. --- handlers/main.yml | 12 ++++++------ tasks/logrotate.yml | 4 ++-- tasks/powertop.yml | 12 ++++++------ tasks/repos.yml | 8 ++++---- tasks/subscription.yml | 8 ++++---- tasks/swap.yml | 12 ++++++------ 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 7afd6de..5a24f50 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -2,14 +2,14 @@ # ansible_role_proxmox_provision/handlers/main.yml # Handlers for role # ================== -- name: apt update - apt: +- name: Run apt update + ansible.builtin.apt: update_cache: yes -- name: restart pveproxy - systemd: +- name: Restart pveproxy + ansible.builtin.systemd: name: pveproxy state: restarted -- name: reload systemd - command: systemctl daemon-reexec +- name: Reload systemd + ansible.builtin.command: systemctl daemon-reexec diff --git a/tasks/logrotate.yml b/tasks/logrotate.yml index c3e037b..1e71c99 100644 --- a/tasks/logrotate.yml +++ b/tasks/logrotate.yml @@ -1,6 +1,6 @@ --- -- name: Configure Proxmox logrotate limits - template: +- name: logrotate | Configure Proxmox logrotate limits + ansible.builtin.template: src: logrotate-pve.j2 dest: /etc/logrotate.d/proxmox owner: root diff --git a/tasks/powertop.yml b/tasks/powertop.yml index ad5029f..c8c5f9b 100644 --- a/tasks/powertop.yml +++ b/tasks/powertop.yml @@ -1,21 +1,21 @@ --- -- name: Install powertop - apt: +- name: powertop | Install powertop + ansible.builtin.apt: name: powertop state: present update_cache: yes when: proxmox_enable_powertop -- name: Create powertop systemd service - template: +- name: powertop | Create powertop systemd service + ansible.builtin.template: src: powertop.service.j2 dest: /etc/systemd/system/powertop.service mode: "0644" when: proxmox_enable_powertop notify: reload systemd -- name: Enable and start powertop service - systemd: +- name: powertop | Enable and start powertop service + ansible.builtin.systemd: name: powertop enabled: true state: started diff --git a/tasks/repos.yml b/tasks/repos.yml index b84fbf8..62b929b 100644 --- a/tasks/repos.yml +++ b/tasks/repos.yml @@ -1,14 +1,14 @@ --- -- name: Remove enterprise repo files (all known locations) - file: +- name: repos | Remove enterprise repo files (all known locations) + ansible.builtin.file: path: "{{ item }}" state: absent loop: - /etc/apt/sources.list.d/pve-enterprise.list - /etc/apt/sources.list.d/ceph.list -- name: Enable Proxmox no-subscription repo - copy: +- name: repos | Enable Proxmox no-subscription repo + ansible.builtin.copy: dest: /etc/apt/sources.list.d/pve-no-subscription.list content: | deb http://download.proxmox.com/debian/pve {{ ansible_distribution_release }} pve-no-subscription diff --git a/tasks/subscription.yml b/tasks/subscription.yml index 20c1fe9..710da0f 100644 --- a/tasks/subscription.yml +++ b/tasks/subscription.yml @@ -1,14 +1,14 @@ --- -- name: Remove subscription nag (legacy proxmoxlib.js) - replace: +- name: subscription | Remove subscription nag (legacy proxmoxlib.js) + ansible.builtin.replace: path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js regexp: "if \\(data.status !== 'Active'\\)" replace: "if (false)" ignore_errors: true notify: restart pveproxy -- name: Remove subscription nag (minified bundle for VE 8/9) - replace: +- name: subscription | Remove subscription nag (minified bundle for VE 8/9) + ansible.builtin.replace: path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js regexp: "data.status!=='Active'" replace: "false" diff --git a/tasks/swap.yml b/tasks/swap.yml index 318be35..8dccfb6 100644 --- a/tasks/swap.yml +++ b/tasks/swap.yml @@ -1,20 +1,20 @@ --- -- name: Set vm.swappiness - sysctl: +- name: swap | Set vm.swappiness + ansible.posix.sysctl: name: vm.swappiness value: "{{ proxmox_swapiness }}" state: present reload: yes -- name: Disable swap if host has enough RAM - command: swapoff -a +- name: swap | Disable swap if host has enough RAM + ansible.builtin.command: swapoff -a when: - proxmox_disable_swap - ansible_memtotal_mb >= proxmox_min_ram_mb_for_no_swap changed_when: false -- name: Remove swap from fstab - replace: +- name: swap | Remove swap from fstab + ansible.builtin.replace: path: /etc/fstab regexp: '^\S+\s+\S+\s+swap\s+.*$' replace: ''