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:
@@ -5,26 +5,18 @@
|
|||||||
mac_address: "8E:90:31:DE:31:36"
|
mac_address: "8E:90:31:DE:31:36"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Install python3-pip package
|
|
||||||
ansible.builtin.package:
|
- name: Install 'proxmoxer' and 'requests' Python libraries for the Semaphore user
|
||||||
# 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
|
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
# List both libraries here
|
|
||||||
name:
|
name:
|
||||||
- proxmoxer
|
- proxmoxer
|
||||||
- requests
|
- requests
|
||||||
state: present
|
state: present
|
||||||
# delegate_to: localhost
|
# Installs to the home directory of the user running Semaphore, avoiding system conflicts.
|
||||||
become: yes # Use 'become: yes' if installing to the system Python environment
|
extra_args: "--user"
|
||||||
|
# Run as the user that executes the Ansible playbooks in Semaphore
|
||||||
|
become: no
|
||||||
|
delegate to: localhost
|
||||||
|
|
||||||
- name: Create lxc container
|
- name: Create lxc container
|
||||||
community.proxmox.proxmox:
|
community.proxmox.proxmox:
|
||||||
|
|||||||
Reference in New Issue
Block a user