Hi All,
Sorry for the N00b question, but with the community.proxmox
collection, do the dependencies (ie proxmoxer
and requests
) get installed on the Ansible Control Computer, or the Proxmox Server?
Thanks in advance
Dulux-Oz
Hi All,
Sorry for the N00b question, but with the community.proxmox
collection, do the dependencies (ie proxmoxer
and requests
) get installed on the Ansible Control Computer, or the Proxmox Server?
Thanks in advance
Dulux-Oz
Hi and welcome to the forum!
If you’re installing a collection with ansible-galaxy collection install
, Python and system dependencies are not installed at all. You have to do that manually.
If you’re building an Execution Environment with ansible-builder, then dependencies that the collection specifies are installed in the execution environment. In case of community.proxmox, this would be the Python package proxmoxer >= 2.0
(community.proxmox/meta/ee-requirements.txt at main · ansible-collections/community.proxmox · GitHub).
Hi @felixfontein,
Thank you for getting back to me - I really appreciate it.
I was aware of everything you pointed out, and my Ansible Control Computer (the one I run ansible-playbook
from) is in the state you recommend (python’s installed, so is pip, and I’ve run the ansible-galaxy
command).
However, what is tripping me up (apart from my general N00b-ness, or perhaps because of it) is that in the documentation for that collection’s modules it lists two dependencies (see my OP), along with the line The below requirements are needed on the host that executes this module.
I am unable to determine which “host” that line is referring too: my Proxmox Host or my Ansible Control Host - hence my question.
Would someone be kind and take pity on me and let me know - yes, it’s entirely my fault in not being able to parse that instruction correctly, but as I’ve said, I need some help - thanks.
Cheers
Dulux-oz
Hi there!
It depends ™! You can run the playbook on both nodes, either install Proxmoxer on the node you’re targeting (which probably is the proxmox node), or, install it on the Ansible controller and run the tasks locally, like this:
---
- name: 'Install updates on production hosts'
hosts: 'all, !proxmox_nodes, !localhost, !irregular_online'
tasks:
- name: 'Ensure proxmoxer via pip'
ansible.builtin.pip:
name: 'proxmoxer'
state: 'present'
become: false
run_once: true
delegate_to: 'localhost'
- name: 'Remove old maintenance snapshots of Proxmox VMs'
community.proxmox.proxmox_snap:
api_user: "{{ proxmox_username }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ proxmox_cluster }}"
vmid: "{{ proxmox_vmid }}"
state: 'absent'
snapname: "{{ snapshot }}"
loop: "{{ proxmox_snapshots }}"
loop_control:
loop_var: 'snapshot'
when:
- proxmox_vmid is defined
- snapshot is match("^maintenance_snap_*")
- snapshot is not match("^maintenance_snap_" + ansible_facts['date_time']['date'])
delegate_to: 'localhost'
retries: 3
delay: 3
- name: 'Create maintenance snapshots of Proxmox VMs'
community.proxmox.proxmox_snap:
api_user: "{{ proxmox_username }}"
api_password: "{{ proxmox_password }}"
api_host: "{{ proxmox_cluster }}"
vmid: "{{ proxmox_vmid }}"
state: 'present'
snapname: "maintenance_snap_{{ ansible_facts['date_time']['date'] }}"
description: 'Pre system-updates'
when: proxmox_vmid is defined
delegate_to: 'localhost'
become: false
This is a snippet from my os_update_and_reboot.yml
playbook