Skip to content

Add virtualization role - #145

Merged
pymnh merged 3 commits into
mainfrom
pymnh/libvirt
Nov 30, 2026
Merged

pymnh merged 3 commits into
mainfrom
pymnh/libvirt

Conversation

@pymnh

@pymnh pymnh commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

See roles/virt/README.md on how to test the role.

Tasks for installation and configuration of prometheus-libvirt-exporter are split into their role at roles/prometheus_libvirt_exporter to reduce complexity, and because the latter can easily be tested with molecule, while testing the virtualization inside podman containers does not make any sense. Molecule testing is not yet included, because I want to avoid merge conflicts with #117

Right now the tasks for setting up the host/libvirt and tasks for provisioning the guests are folded up inside roles/virt. the entry point for guest provisioning is roles/virt/tasks/guests.yml which in turn dynamically (i.e. based on the content of the variables virt_guests and virt_guests_delete) loops over the various tasks in roles/virt/tasks/guest/.

For each guest item in the loop, arguments are validated in roles/virt/tasks/guest/preflight.yml, which is a bit awkward as it might fail unexpectedly at runtime. It might make sense to split out the guest-specific tasks into a single, re-usable role, with a "proper", role-level argument validation, but maybe that is premature optimization, therefore I have left it as is for now

the new role introduces a new variable convention for internal and public interfaces, because the old schema (host_data.site_ipv4, host_data.global_ipv4) was not well suited (working with dicts variables in ansible is cumbersome, so if you have to, their structure should be well suited for their usage) and because the naming scheme host_data does not adhere to ansible best practices. I will align the host_data to the "new" variable convention in another PR :)

  network_networks:
    private:
      address4: 192.168.100.103
    public:
      mac: 00:50:56:00:FD:9C
      address4: 5.9.108.212/27
      gateway4: 5.9.108.193
      address6: "2a01:4f8:162:44c7::3/64"
      gateway6: 'fe80::1'

@pymnh
pymnh force-pushed the pymnh/libvirt branch 6 times, most recently from ee1e1ea to f372238 Compare October 29, 2026 15:39
@pymnh
pymnh force-pushed the pymnh/libvirt branch 2 times, most recently from 0dc4a3d to 3a570b3 Compare November 16, 2026 16:20
@pymnh
pymnh force-pushed the pymnh/libvirt branch 2 times, most recently from 16af5d0 to 1898787 Compare November 23, 2026 18:04
@pymnh pymnh changed the title WIP: libvirt Virtualization role Nov 23, 2026
@pymnh pymnh changed the title Virtualization role Add virtualization role Nov 23, 2026
@pymnh
pymnh marked this pull request as ready for review November 23, 2026 18:05
@pymnh
pymnh marked this pull request as draft November 24, 2026 16:38
@pymnh
pymnh force-pushed the pymnh/libvirt branch 3 times, most recently from 5942093 to 0e90792 Compare November 26, 2026 16:03
@pymnh
pymnh marked this pull request as ready for review November 26, 2026 16:10
@pymnh
pymnh requested a review from krmax44 November 26, 2026 16:10
@pymnh
pymnh force-pushed the pymnh/libvirt branch 3 times, most recently from 335ca9a to e40451d Compare November 30, 2026 10:37
@pymnh
pymnh merged commit 874274c into main Nov 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant