Echoing what others have said. Ansible is your best option here.
On Thu, Feb 27, 2020 at 7:22 AM Nathanaël Blanchet <blanchet(a)abes.fr> wrote:
Le 27/02/2020 à 11:00, Yedidyah Bar David a écrit :
On Thu, Feb 27, 2020 at 11:53 AM Eugène Ngontang <sympavali(a)gmail.com>
<sympavali(a)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 modules
hosts: localhost
connection: local
tasks:
- block:
- include: ovirt_auth.yaml
tags: auth,change
- name: vm facts
ovirt_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:
vm_status: "{{ vm_status|default({})|combine({item.name: item.status}) }}"
loop: "{{vm_info.ovirt_vms}}"
when: item.status == "up"
- debug:
msg: "{{vm_status}}"
always:
- include: ovirt_auth_revoke.yaml
tags: auth,change
Good 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
SIRE227 avenue Professeur-Jean-Louis-Viala
<
https://www.google.com/maps/search/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 14blanchet(a)abes.fr
_______________________________________________
Users mailing list -- users(a)ovirt.org
To unsubscribe send an email to users-leave(a)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/LDCRW5YXHEM...