this post was submitted on 31 May 2025
41 points (90.2% liked)

Selfhosted

46672 readers
850 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

Hi, got Proxmox installed. Now want to install some VMs but would like to use a simple setup rather than painfully going trough an install. I've read I could accomplish this via ansible. Are there ready playbooks you can hack? Presumably I would need to have Proxmox understand playbooks?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 1 day ago* (last edited 1 day ago)

If you needs are simple, write a simple playbook using the proxmox ansible module https://docs.ansible.com/ansible/latest/collections/community/general/proxmox_kvm_module.html

Terraform/Opentofu provides more advanced stuff but then you have to worry about persistent state storage, the clunky DSL... used it when acsolutely needed, you can do 90% of this stuff with the proxmox ansible module.

If you need to make your playbook less verbose, move the logic to a role so that you can configure your VMs from a few lines in the playbook/host_vars. Mine looks like this (it's for libvirt and not proxmox, but the logic is the same)

# playbook.yml
- hosts: hypervisor.example.org
  roles:
    - libvirt

# host_vars/hypervisor.example.org.yml
libvirt_vms:
  - name: vm1.example.org
    xml_file: "{{ playbook_dir }}/data/libvirt/vm1.example.org.xml"
    state: running
    autostart: yes
  - name: vm2.example.org
    xml_file: "{{ playbook_dir }}/data/libvirt/vm2.example.org.xml"
    autostart: no
  - name: vm3.example.org
    xml_file: "{{ playbook_dir }}/data/libvirt/vm3.example.org.xml"
    autostart: no
  - name: vm4.example.org
    xml_file: "{{ playbook_dir }}/data/libvirt/vm4.example.org.xml"
    autostart: no
    disk_size: 100G