_______________________________________________
Le 27/02/2020 à 11:00, Yedidyah Bar David a écrit :
On Thu, Feb 27, 2020 at 11:53 AM Eugène Ngontang <sympavali@gmail.com> wrote:Yes Ansible ovirt_vms module is useful, I use it for provisioning/deployment, but once my VM created, I'd like to administrate/interact with them, I don't think I should write playbooks for that.Why not? You're the next devops :)
I was used to use ovirt-shell (removed from 4.4), and instead of it I control now all my vms with ansible playbooks:
- consultation with ovirt-*_inf with appropriate filters (combine , dict2items) and conditions (when, until)
- interaction with other modules (with present/absent statement for all parameters)
I precise I am not a developer but once I took the habit with a proper environment (venv, IDE, loops, structured playbook and roles, dict struct, etc..), I was able do what I want, or rather what the API let me do.
Before begining, I should advice you to take the time to study the structure of the output of the registered variable
Here is a piece of my commonly used playbooks to check status of wanted vms:
- name: template ovirt pour tester les moduleshosts: localhostconnection: localtasks:- block:- include: ovirt_auth.yamltags: auth,change- name: vm factsovirt_vm_info:auth: "{{ ovirt_auth }}"pattern: "name=vm5 or name=vm8"register: vm_info- debug: var=vm_info.ovirt_vms# msg: "{{vm_info.ovirt_vms | map(attribute='status')|list}}"- name: "Génération d'un dictionnaire avec combine"set_fact:loop: "{{vm_info.ovirt_vms}}"when: item.status == "up"- debug:msg: "{{vm_status}}"always:- include: ovirt_auth_revoke.yamltags: auth,changeGood luck!
This is up to you, of course. For a project that uses heavily the ansible modules, see ovirt-ansible-hosted-engine-setup. For one that uses the python SDK, see ovirt-system-tests. The SDK itself also has a very useful collection of examples.But I'll find a solution.Good luck and best regards,-- Nathanaël Blanchet Supervision réseau SIRE 227 avenue Professeur-Jean-Louis-Viala 34193 MONTPELLIER CEDEX 5 Tél. 33 (0)4 67 54 84 55 Fax 33 (0)4 67 54 84 14 blanchet@abes.fr
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/LDCRW5YXHEMEY77XTHQKV4CAHHUKF43E/