Replace docker_container_exec virt-install with community.libvirt module #15

Open
opened 2026-06-19 23:12:42 +01:00 by bits · 1 comment
Owner

The current create.yml uses community.docker.docker_container_exec to run virt-install inside the container via a raw shell command. This should be replaced with the community.libvirt.virt_install Ansible module for a more declarative and maintainable approach.

Proposed Approach

Use delegate_to: neticenter-test to run the community.libvirt.virt_install module inside the container where libvirt is available, rather than on the host machine.

Prerequisites

  • python3-lxml installed in the container (added to Dockerfile)
  • python3-libvirt installed in the container (already present)
  • community.libvirt >= 2.2.0 added to requirements.yml

Acceptance Criteria

  • create.yml uses community.libvirt.virt_install instead of docker_container_exec
  • destroy.yml uses community.libvirt.virt to destroy the domain
  • Molecule test suite passes with the new approach
The current `create.yml` uses `community.docker.docker_container_exec` to run `virt-install` inside the container via a raw shell command. This should be replaced with the `community.libvirt.virt_install` Ansible module for a more declarative and maintainable approach. ### Proposed Approach Use `delegate_to: neticenter-test` to run the `community.libvirt.virt_install` module inside the container where libvirt is available, rather than on the host machine. ### Prerequisites - `python3-lxml` installed in the container (added to Dockerfile) - `python3-libvirt` installed in the container (already present) - `community.libvirt >= 2.2.0` added to `requirements.yml` ### Acceptance Criteria - [ ] `create.yml` uses `community.libvirt.virt_install` instead of `docker_container_exec` - [ ] `destroy.yml` uses `community.libvirt.virt` to destroy the domain - [ ] Molecule test suite passes with the new approach
Author
Owner
https://docs.ansible.com/projects/ansible/latest/collections/community/libvirt/virt_install_module.html https://galaxy.ansible.com/ui/repo/published/community/libvirt/content/module/virt_install/
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
neticenter/neticenter#15
No description provided.