From cb21bef26301f5b93fc88b5b41ca0293a13a5b01 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 22 Oct 2025 17:56:31 +0200 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactored=20t?= =?UTF-8?q?he=20tasks/setupacdc.yml=20file=20to=20install=20'proxmoxer'=20?= =?UTF-8?q?and=20'requests'=20Python=20libraries=20for=20the=20Semaphore?= =?UTF-8?q?=20user,=20ensuring=20they=20are=20installed=20in=20the=20home?= =?UTF-8?q?=20directory=20of=20the=20user=20running=20the=20Ansible=20play?= =?UTF-8?q?books.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated the setup process to use a more specific user environment for installing Python libraries. --- tasks/setupacdc.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tasks/setupacdc.yml b/tasks/setupacdc.yml index 66ee975..0a5bfdd 100644 --- a/tasks/setupacdc.yml +++ b/tasks/setupacdc.yml @@ -5,26 +5,18 @@ mac_address: "8E:90:31:DE:31:36" tasks: - - name: Install python3-pip package - ansible.builtin.package: - # Use the appropriate package name based on the distribution - name: "{{ __pip_package_name }}" - state: absent - vars: - __pip_package_name: "{% if ansible_os_family == 'Debian' %}python3-pip{% elif ansible_os_family == 'RedHat' %}python3-pip{% elif ansible_os_family == 'Suse' %}python3-pip{% else %}python3-pip{% endif %}" - # Ensure the package manager cache is updated before installation, especially on Debian/Ubuntu - when: ansible_os_family in ['Debian', 'RedHat', 'Suse'] - - - name: Install 'proxmoxer' and 'requests' Python libraries on the control node + + - name: Install 'proxmoxer' and 'requests' Python libraries for the Semaphore user ansible.builtin.pip: - # List both libraries here name: - proxmoxer - requests state: present - # delegate_to: localhost - become: yes # Use 'become: yes' if installing to the system Python environment - + # Installs to the home directory of the user running Semaphore, avoiding system conflicts. + extra_args: "--user" + # Run as the user that executes the Ansible playbooks in Semaphore + become: no + delegate to: localhost - name: Create lxc container community.proxmox.proxmox: