refactor ♻️: Refactored the tasks/setupacdc.yml file to install 'proxmoxer' and 'requests' Python libraries for the Semaphore user, ensuring they are installed in the home directory of the user running the Ansible playbooks.

Updated the setup process to use a more specific user environment for installing Python libraries.
This commit is contained in:
2025-10-22 17:56:31 +02:00
parent d87a47af2d
commit cb21bef263

View File

@@ -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: