This is a multi-part message in MIME format.
--------------97F06AFCAFA52500BDCD4A3E
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
Thanks, all works as expected.
Now, I try make roles.
here it is :
*cat /etc/ansible/roles/ovirt_vm_facts/tasks/main.yml*
- name: get vm facts
ovirt_vms_facts:
auth:
url: https://{{ engine }}.v100.abes.fr/ovirt-engine/api
username: "{{ username }}"
password: "{{ password }}"
insecure: "{{ insecure }}"
pattern: "{{ pattern }}"
- debug:
msg: "{{ ovirt_vms | map(attribute=3D'name') | join(' ')
}}"
*cat /etc/ansible/roles/ovirt_vm_facts/vars/main.yml*
pattern: "os=3Drhel_5x64 or os=3Drhel_5"
engine: air
username: admin@internal
password: ovirt123
insecure: true
and I call those files with */tmp/ovirt_vm_facts.yml* with extra=20
variables if needed
- hosts: localhost
connection: local
roles:
- ovirt_vm_fact
running ansible-playbook /tmp/ovirt_vm_facts.ym -e 'pattern=3D"name=3Daci=
er*=20
and cluster=3DDev"'
*But..*
I don't want to do the same for each ansible module shipped with 2.3.
Knowing that each *facts module has the same structure auth/pattern, is=20
there a way to play a generic playbook independant from the role, like:
- hosts: localhost
connection: local
roles:
- ovirt_facts (with somewhere a variable "myfact")
which would play an unique role=20
*/etc/ansible/roles/ovirt_facts/tasks/main.yml with*
- name: get vm facts
myfact
auth:
....
Hope to be clear enough, thank your for your help.
Le 10/05/2017 =C3=A0 13:14, Ondra Machacek a =C3=A9crit :
On Wed, May 10, 2017 at 12:38 PM, Nathana=C3=ABl Blanchet <blanchet@abe=
s.fr=20
<mailto:blanchet@abes.fr>> wrote:
Le 10/05/2017 =C3=A0 10:29, Ondra Machacek a =C3=A9crit :
> Not sure I understand. You can use Ansible module to list VMs, you
> can use ovirt_vms _facts[1] module.
> For example to get only stopped VMs, you can use
following:
> - name: Get stopped VMs
> ovirt_vms_facts:
> auth:
> url:
https://ovirt.example.com/ovirt-engine/api
> <
https://ovirt.example.com/ovirt-engine/api
>
username: admin@internal
> password: password
> ca_file: /etc/pki/ovirt-engine/ca.pem
> pattern: "status =3D down"
I want a list of vms sorted by any possible attributes, i.e.
sorted by datacenter or cluster, not only by status.
* For example, ovirt_vms_facts doesn't allow to get the
datacenter the vm belongs to , and the pattern filter doesn't
return a list of vms as expected:
- hosts: localhost
connection: local
tasks:
- name: Get stopped VMs
ovirt_vms_facts:
auth:
url:
https://acore.v100.abes.fr/ovirt-engine/api
<
https://acore.v100.abes.fr/ovirt-engine/api
username: admin@internal
password: ovirt123
insecure: true
pattern: name=3Dcentos* and cluster=3Dwest
- debug:
var: ovirt_vms
- shell: echo "{{ ovirt_vms.name <
http://ovirt_vms.name> }}"
Ok, I understand, now.
You have few options here.
If you want for example only VMs from datacenter 'X', you can use=20
following:
- hosts: localhost
connection: local
tasks:
- name: Get VMs from datacenter X
ovirt_vms_facts:
pattern: datacenter=3DX
auth:
url:
https://acore.v100.abes.fr/ovirt-engine/api=20
<
https://acore.v100.abes.fr/ovirt-engine/api
username: admin@internal
password: ovirt123
insecure: true
- debug:
msg: "{{ ovirt_vms | map(attribute=3D'name') | list }}"
How can I successfully display this list of vms like described here=
:
name description returned type sample
ovirt_vms List of dictionaries describing the VMs. VM attribues
are mapped to dictionary keys, all VMs attributes can be found at
following url:
https://ovirt.example.com/ovirt-engine/api/model#types/vm
<
https://ovirt.example.com/ovirt-engine/api/model#types/vm>. On
success. list =09
* About the python SDK:
list_vms.py could be what I expect, but vm.datacenter_name doesn't
exist
Yes, because the 'data_center' parameter isn't part of the VM type.=20
Take a look here[1],
you will find there all attributes the VM has. As you can see there is=20
no 'datacenter', but
there is a 'cluster', but as said in documentation, it's just a=20
reference to the cluster. That
means that it contains the ID of the cluster and the 'href' to the=20
cluster, so you can get
the cluster object by following that reference using this code:
vm_cluster =3D connection.follow_link(vm.cluster)
print vm_cluster.name <
http://vm_cluster.name
# Same for datacenter:
vm_dc =3D connection.follow_link(vm_cluster.data_center)
print vm_dc.name <
http://vm_dc.name
What you need to understand is, what is the difference between the 'ful=
l'
object and the reference to the object. It's good to take a look
at=20
the XML
output of the API and learn to read the API specification documentation=
,
when working with oVirt Ansible and Python SDK.
[1]
http://ovirt.github.io/ovirt-engine-api-model/master/#types/vm
> [1]
http://docs.ansible.com/ansible/ovirt_vms_facts_module.html
> <
http://docs.ansible.com/ansible/ovirt_vms_facts_module.html
> On Wed, May 10, 2017 at
10:13 AM, Nathana=C3=ABl Blanchet
> <blanchet(a)abes.fr <mailto:blanchet@abes.fr>> wrote:
> Thanks, I knew this python script, but I believed
it was
> possible to do the same with an ansible module.
> That's mean we need several tools to do
different tasks, it
> is not a very convergent way to proceed... but it is feasable.
> Le 10/05/2017 =C3=A0
07:56, Ondra Machacek a =C3=A9crit :
>
>
>> On Tue, May 9, 2017
at 6:52 PM, Nathana=C3=ABl Blanchet
>> <blanchet(a)abes.fr <mailto:blanchet@abes.fr>> wrote:
>
>> Hello,
>
>> I didn't find anyway to easy list all
my vms thanks to
>> the ansible modules...
>> I tried the ovirt4.py script which is able to list the
>> whole facts, so vms list, when the number of them is
>> small in a test datacenter, but in a production
>> datacenter, I get an issue:
>
>> File "./ovirt4.py", line 262,
in <module
>> main()
>> File "./ovirt4.py", line 254, in main
>> vm_name=3Dargs.host,
>> File "./ovirt4.py", line 213, in get_data
>> vms[name] =3D get_dict_of_struct(connection, vm)
>> File "./ovirt4.py", line 185, in get_dict_of_struct
>> (device.name <
http://device.name>, [ip.address for
>> ip in device.ips]) for device in devices
>> File "./ovirt4.py", line 185, in <genexpr
>> (device.name
<
http://device.name>, [ip.address for
>> ip in device.ips]) for device in devices
>> TypeError: 'NoneType' object is not iterable
>
>
>> This error was
fixed already, try to download latest
>> ovirt4.py file.
>
>> The other way is to use fatcs[1] module.
>
>> [1]
>>
http://docs.ansible.com/ansible/ovirt_vms_facts_module.html
>> <
http://docs.ansible.com/ansible/ovirt_vms_facts_module.html
>
>
>
>> What is the simpliest way to get this
basic information
>> with sdk4??? (with sdk3 : ovirt-shell -E "list vms")
>
>
>> Please take a look
at the following example:
>
>>
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/exa= mples/list_vms.py
amples/list_vms.py
>
>
>
>
>> --=20
>> Nathana=C3=ABl Blanchet
>
>> Supervision r=C3=A9seau
>> P=C3=B4le Infrastrutures Informatiques
>> 227 avenue Professeur-Jean-Louis-Viala
>> 34193 MONTPELLIER CEDEX 5
>> T=C3=A9l. 33 (0)4 67 54 84 55
>> Fax 33 (0)4 67 54 84 14
>> blanchet(a)abes.fr <mailto:blanchet@abes.fr
>
>>
_______________________________________________
>> Users mailing list
>> Users(a)ovirt.org <mailto:Users@ovirt.org
>>
http://lists.ovirt.org/mailman/listinfo/users
>> <
http://lists.ovirt.org/mailman/listinfo/users
>
>
> --=20
> Nathana=C3=ABl Blanchet
> Supervision r=C3=A9seau
> P=C3=B4le Infrastrutures Informatiques
> 227 avenue Professeur-Jean-Louis-Viala
> 34193 MONTPELLIER CEDEX 5 =09
> T=C3=A9l. 33 (0)4 67 54 84 55
> Fax 33 (0)4 67 54 84 14
> blanchet(a)abes.fr <mailto:blanchet@abes.fr> =20
--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
blanchet(a)abes.fr <mailto:blanchet@abes.fr> =20
--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
blanchet(a)abes.fr
--------------97F06AFCAFA52500BDCD4A3E
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<html
<head
<meta content=3D"text/html; charset=3Dutf-8"
http-equiv=3D"Content-Ty=
pe"
</head
<body bgcolor=3D"#FFFFFF"
text=3D"#000000"
<p>Thanks, all works as
expected.</p
<p>Now, I try make
roles.</p
<p>here it is : <br
</p
<p><b>cat /etc/ansible/roles/ovirt_vm_facts/tasks/main.yml</b></p
<p>=C2=A0 - name: get vm facts<br
=C2=A0=C2=A0=C2=A0 ovirt_vms_facts:<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 auth:<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 url: <a
class=3D"moz-txt=
-link-freetext" href=3D"https://">https://</a>{{ engine
}}.v100.abes.fr/o=
virt-engine/api<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 username: "{{ username }=
}"<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 password: "{{ password }=
}"<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 insecure: "{{ insecure }=
}"<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
pattern: "{{ pattern }}"<br
=C2=A0 - debug:<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
msg: "{{ ovirt_vms | map(attribute=3D=
'name') | join(' ') }}"</p
<p><b>cat /etc/ansible/roles/ovirt_vm_facts/vars/main.yml</b></p
<p>pattern: "os=3Drhel_5x64 or
os=3Drhel_5"<br
engine: air<br
username: admin@internal<br
password: ovirt123<br
insecure: true</p
<p>and I call those files
with <b>/tmp/ovirt_vm_facts.yml</b> with
extra variables if needed<br
</p
<p>- hosts: localhost<br
=C2=A0 connection: local<br
=C2=A0 roles:<br
=C2=A0=C2=A0=C2=A0 - ovirt_vm_fact</p
<p>running ansible-playbook /tmp/ovirt_vm_facts.ym -e
'pattern=3D"name=3Dacier* and cluster=3DDev"'<br
</p
<p><b>But..</b></p
<p>I don't want to do the same for each ansible module shipped with
2.3.</p
<p>Knowing that each
*facts module has the same structure
auth/pattern, is there a way to play a generic playbook
independant from the role, like:</p
<p>- hosts: localhost<br
=C2=A0 connection:
local<br
=C2=A0 roles:<br
=C2=A0=C2=A0=C2=A0 - ovirt_facts (with somewhere a
variable "myfact=
")<br
</p
<p>which would play an unique role
<b>/etc/ansible/roles/ovirt_facts/=
tasks/main.yml
with</b></p
<p><br
- name: get vm facts<br
=C2=A0=C2=A0=C2=A0 myfact<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
auth:<br
=C2=A0=C2=A0=C2=A0
=C2=A0=C2=A0=C2=A0 ....<br
</p
<p>Hope to be clear enough, thank your for your
help.<br
</p
<br
<div class=3D"moz-cite-prefix">Le 10/05/2017 =C3=A0 13:14, Ondra Mach=
acek a
=C3=A9crit=C2=A0:<br
</div
<blockquote
cite=3D"mid:CAJCqMsXDFWK7fUGyzGcAabdYAh_t9wktmVdaJd+qE3xVJfYnnQ@mail.gmai=
l.com"
type=3D"cite"
<div
dir=3D"ltr"><br
<div
class=3D"gmail_extra"><br
<div class=3D"gmail_quote">On Wed, May 10, 2017 at 12:38 PM,
Nathana=C3=ABl Blanchet <span dir=3D"ltr"><<a
moz-do-not-send=3D"true"
href=3D"mailto:blanchet@abes.fr"
target=3D"_blank">blanchet(a)abes.fr</a>&gt;</span>
wrote:<=
br
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<div bgcolor=3D"#FFFFFF"><span class=3D"gmail-"> Le
10/05/2=
017
=C3=A0 10:29, Ondra Machacek a =C3=A9crit=C2=A0:<br
<blockquote type=3D"cite"
<div dir=3D"ltr"
<div
<div
<div
<div
<div
<div
<div
<div
<div
<div>Not sure I
understand. You
can use Ansible module to list
VMs, you<br
</div
can use ovirt_vms _facts[1]
module.<br
<br
</div
For example to get only stopped
VMs, you can use following:<br
<br
</div
- name: Get stopped
VMs<br
</div
=C2=A0 ovirt_vms_facts:<br
</div
=C2=A0=C2=A0=C2=A0 auth:<br
</div
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 url: <a moz-=
do-not-send=3D"true"
href=3D"https://ovirt.example.com/ovirt-e=
ngine/api"
target=3D"_blank">https://ovirt.example.c=
om/<wbr>ovirt-engine/api</a><br
</div
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 username: admi=
n@internal<br
</div
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 password: passwo=
rd<br
</div
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ca_file:
/etc/pki/=
ovirt-engine/ca.pem<br
</div
=C2=A0=C2=A0=C2=A0 pattern: "status
=3D down"<br
</div
</blockquote
</span> I want a list of vms sorted by any possible
attributes, i.e. sorted by datacenter or cluster, not
only by status.<br
<ul
<li>For
example, ovirt_vms_facts doesn't allow to get
the datacenter the vm belongs to , and the pattern
filter doesn't return a list of vms as expected:</li
</ul
<br
- hosts:
localhost<br
=C2=A0 connection:
local<br
=C2=A0
tasks:<span class=3D"gmail-"><br
=C2=A0 - name: Get stopped VMs<br
=C2=A0=C2=A0=C2=A0 ovirt_vms_facts:<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 auth:<br
</span> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 url: <=
a moz-do-not-send=3D"true"
class=3D"gmail-m_344037001981379143moz-txt-link-freetex=
t"
href=3D"https://acore.v100.abes.fr/ovirt-engine/api"
target=3D"_blank">https://acore.v100.abes.fr/<wbr>ovirt=
-engine/api</a><br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 username: admi=
n@internal<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 password: ovir=
t123<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 insecure: true=
<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
pattern: name=3D=
centos* and cluster=3Dwest<br
=C2=A0 -
debug:<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 var: ovirt_vms<br
=C2=A0 - shell: echo "{{ <a moz-do-not-send=3D"true"
href=3D"http://ovirt_vms.name"
target=3D"_blank">ovirt_=
vms.name</a
}}"<br
</div
</blockquote
<div><br
<br
</div
<div>Ok, I
understand, now.<br
</div
<div>You have few options here.<br
</div
<div>If you want for example only VMs from datacenter 'X',
you can use following:<br
<br
- hosts:
localhost<br
=C2=A0 connection:
local<br
=C2=A0 tasks:<span
class=3D"gmail-im"><br
=C2=A0 - name: Get VMs from datacenter X<br
=C2=A0=C2=A0=C2=A0 ovirt_vms_facts:</span><br
<span class=3D"gmail-im"> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pa=
ttern: datacenter=3DX<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 auth:<br
</span> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 url: <a =
moz-do-not-send=3D"true"
class=3D"gmail-m_344037001981379143moz-txt-link-freetext"
href=3D"https://acore.v100.abes.fr/ovirt-engine/api"
target=3D"_blank">https://acore.v100.abes.fr/<wbr>ovirt-e=
ngine/api</a><br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 username: admin@=
internal<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 password: ovirt1=
23<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 insecure: true<b=
r
=C2=A0 - debug:<br
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 msg: "{{
ovirt_vms | map(att=
ribute=3D'name') | list
}}"<br
</div
<div>=C2=A0</div
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<div bgcolor=3D"#FFFFFF"> <br
How can I successfully display this list of vms like
described here :<br
<table border=3D"1" cellpadding=3D"4"
<tbody
<tr
<th
class=3D"gmail-m_344037001981379143head">name</=
th
<th
class=3D"gmail-m_344037001981379143head">descri=
ption</th
<th
class=3D"gmail-m_344037001981379143head">return=
ed</th
<th
class=3D"gmail-m_344037001981379143head">type</=
th
<th
class=3D"gmail-m_344037001981379143head">sample=
</th
</tr
<tr
<td>
ovirt_vms </td
<td>
List of dictionaries describing the VMs. VM
attribues are mapped to dictionary keys, all VMs
attributes can be found at following url: <a
moz-do-not-send=3D"true"
class=3D"gmail-m_344037001981379143moz-txt-link=
-freetext"
href=3D"https://ovirt.example.com/ovirt-engine/api/model#types/vm"
target=3D"_blank">https://ovirt.example.com/<wb=
r>ovirt-engine/api/model#types/<wbr>vm</a>.
</td
<td
align=3D"center"> On success. </td
<td align=3D"center"> list </td
<td align=3D"center">
<br
</td
</tr
</tbody
</table
<br
<ul
<li>About the python SDK:</li
</ul
list_vms.py could be what I expect, but
vm.datacenter_name doesn't exist</div
</blockquote
<div><br
</div
<div>Yes, because the 'data_center' parameter isn't part of
the VM type. Take a look here[1],<br
</div
<div>you will find
there all attributes the VM has. As you
can see there is no 'datacenter', but<br
</div
<div>there is a 'cluster', but as said in documentation,
it's just a reference to the cluster. That<br
</div
<div>means that it contains the ID of the cluster and the
'href' to the cluster, so you can get<br
</div
<div>the cluster object by following that reference using
this code:<br
<br
</div
<div>=C2=A0vm_cluster =3D connection.follow_link(vm.cluster)<=
br
</div
<div>=C2=A0print <a moz-do-not-send=3D"true"
href=3D"http://vm_cluster.name">vm_cluster.name</a><br
<br
</div
<div>=C2=A0# Same
for datacenter:<br
</div
<div>=C2=A0vm_dc =3D
connection.follow_link(vm_cluster.data_c=
enter)<br
</div
<div>=C2=A0print <a
moz-do-not-send=3D"true"
href=3D"http://vm_dc.name">vm_dc.name</a><br
<br
</div
What you need to
understand is, what is the difference
between the 'full'<br
</div
<div
class=3D"gmail_quote">object and the reference to the
object. It's good to take a look at the XML<br
</div
<div class=3D"gmail_quote">output of the API and learn to read
the API specification documentation,<br
</div
<div
class=3D"gmail_quote">when working with oVirt Ansible and
Python SDK.<br
</div
<div class=3D"gmail_quote"
<div><br
[1] <a moz-do-not-send=3D"true"
href=3D"http://ovirt.github.io/ovirt-engine-api-model/mas=
ter/#types/vm">http://ovirt.github.io/ovirt-engine-api-model/master/#type=
s/vm</a><br
</div
<div>=C2=A0</div
<blockquote class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<div bgcolor=3D"#FFFFFF"
<div
<div
class=3D"gmail-h5"><br
<blockquote type=3D"cite"
<div dir=3D"ltr"
<div
<div
<div
<div
<div
<div
<div
<div
<div
<div><br
[1] <a
moz-do-not-send=3D"true"
href=3D"http://docs.ansible=
.com/ansible/ovirt_vms_facts_module.html"
target=3D"_blank">http://do=
cs.ansible.com/ansibl<wbr>e/ovirt_vms_facts_module.html</a>&l...
</div
</div
</div
</div
</div
</div
</div
</div
</div
</div
<div
class=3D"gmail_extra"><br
<div class=3D"gmail_quote">On Wed, May 10, 2017 a=
t
10:13 AM, Nathana=C3=ABl Blanchet <span dir=3D"=
ltr"><<a
moz-do-not-send=3D"true"
href=3D"mailto:blanchet@abes.fr"
target=3D"_blank">blanchet(a)abes.fr</a>&gt;<=
/span
wrote:<br
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"
<div
bgcolor=3D"#FFFFFF"
<p>Thanks, I knew this python script, but
I believed it was possible to do the
same with an ansible module.</p
<p>That's mean we need
several tools to do
different tasks, it is not a very
convergent way to proceed... but it is
feasable.<br
</p
<div
<div
class=3D"gmail-m_344037001981379143h5"
<br
<div
class=3D"gmail-m_344037001981379143m_=
-2614652977139427754moz-cite-prefix">Le
10/05/2017 =C3=A0 07:56, Ondra Machac=
ek a
=C3=A9crit=C2=A0:<br
</div
<blockquote type=3D"cite"
<div dir=3D"ltr"><br
<div
class=3D"gmail_extra"><br
<div class=3D"gmail_quote">On Tue=
,
May 9, 2017 at 6:52 PM,
Nathana=C3=ABl Blanchet <span
dir=3D"ltr"><<a
moz-do-not-send=3D"true"
href=3D"mailto:blanchet@abe=
s.fr"
target=3D"_blank">blanchet@=
abes.fr</a>></span
wrote:<br
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Hello,<br
<br
I didn't find anyway to easy
list all my vms thanks to
the ansible modules...<br
I tried the
ovirt4.py script
which is able to list the
whole facts, so vms list,
when the number of them is
small in a test datacenter,
but in a production
datacenter, I get an issue:<b=
r
<br
=C2=A0 File
"./ovirt4.py", li=
ne
262, in <module><br
=C2=A0 =C2=A0
main()<br
=C2=A0 File "./ovirt4.py", li=
ne
254, in main<br
=C2=A0 =C2=A0
vm_name=3Dargs.=
host,<br
=C2=A0 File "./ovirt4.py", li=
ne
213, in get_data<br
=C2=A0 =C2=A0
vms[name] =3D
get_dict_of_struct(connection=
,
vm)<br
=C2=A0 File "./ovirt4.py", li=
ne
185, in get_dict_of_struct<br=
=C2=A0 =C2=A0
(<a
moz-do-not-send=3D"true"
href=3D"http://device.name"
rel=3D"noreferrer"
target=3D"_blank">device.na=
me</a>,
[ip.address for ip in
device.ips]) for device in
devices<br
=C2=A0 File "./ovirt4.py", li=
ne
185, in <genexpr><br
=C2=A0 =C2=A0
(<a
moz-do-not-send=3D"true"
href=3D"http://device.name"
rel=3D"noreferrer"
target=3D"_blank">device.na=
me</a>,
[ip.address for ip in
device.ips]) for device in
devices<br
TypeError: 'NoneType' object
is not iterable<br
</blockquote
<div><br
</div
<div>This error
was fixed
already, try to download
latest ovirt4.py file.<br
<br
</div
<div>The other
way is to use
fatcs[1] module.<br
<br
[1] <a
moz-do-not-send=3D"true"
href=3D"http://docs.ansible=
.com/ansible/ovirt_vms_facts_module.html"
target=3D"_blank">http://do=
cs.ansible.com/ansibl<wbr>e/ovirt_vms_facts_module.html</a>&l...
</div
<div>=C2=A0</div
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"> <br
<br
What is the simpliest way to
get this basic information
with sdk4??? (with sdk3 :
ovirt-shell -E "list vms")<br=
</blockquote
<div><br
</div
<div>Please
take a look at the
following example:<br
<br
=C2=A0<a
moz-do-not-send=3D"t=
rue"
href=3D"https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/ex...
s/list_vms.py"
target=3D"_blank">https://g=
ithub.com/oVirt/ovir<wbr>t-engine-sdk/blob/master/sdk/<wbr>ex...
vms.py</a><br
</div
<div>=C2=A0</div
<blockquote
class=3D"gmail_quote"
style=3D"margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex"> <br
<br
<br
-- <br
Nathana=C3=ABl Blanchet<br
<br
Supervision
r=C3=A9seau<br
P=C3=B4le Infrastrutures
Informatiques<br
227 avenue
Professeur-Jean-Louis-Viala<b=
r
34193 MONTPELLIER
CEDEX 5=C2=A0=
=C2=A0
=C2=A0 =C2=A0<br
T=C3=A9l. 33 (0)4
67 54 84 55=
<br
Fax=C2=A0 33 (0)4
67 54 84 14=
<br
<a
moz-do-not-send=3D"true"
href=3D"mailto:blanchet@abe=
s.fr"
target=3D"_blank">blanchet@=
abes.fr</a><br
<br
______________________________<wbr>_________________<br
Users mailing
list<br
<a moz-do-not-send=3D"true"
href=3D"mailto:Users@ovirt.=
org"
target=3D"_blank">Users@ovi=
rt.org</a><br
<a moz-do-not-send=3D"true"
href=3D"http://lists.ovirt.=
org/mailman/listinfo/users"
rel=3D"noreferrer"
target=3D"_blank">http://li=
sts.ovirt.org/mailman<wbr>/listinfo/users</a><br
</blockquote
</div
<br
</div
</div
</blockquote
<br
<pre
class=3D"gmail-m_34403700198137914=
3m_-2614652977139427754moz-signature" cols=3D"72">--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
<a moz-do-not-send=3D"true"
class=3D"gmail-m_344037001981379143m_-2614652=
977139427754moz-txt-link-abbreviated" href=3D"mailto:blanchet@abes.fr" ta=
rget=3D"_blank">blanchet(a)abes.fr</a> </pre
</div
</div
</div
</blockquote
</div
<br
</div
</blockquote
<br
<pre class=3D"gmail-m_344037001981379143moz-signature=
" cols=3D"72">--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
<a moz-do-not-send=3D"true"
class=3D"gmail-m_344037001981379143moz-txt-li=
nk-abbreviated" href=3D"mailto:blanchet@abes.fr"
target=3D"_blank">blanch=
et(a)abes.fr</a> </pre
</div
</div
</div
</blockquote
</div
<br
</div
</div
</blockquote
<br
<pre class=3D"moz-signature" cols=3D"72">--=20
Nathana=C3=ABl Blanchet
Supervision r=C3=A9seau
P=C3=B4le Infrastrutures Informatiques
227 avenue Professeur-Jean-Louis-Viala
34193 MONTPELLIER CEDEX 5 =09
T=C3=A9l. 33 (0)4 67 54 84 55
Fax 33 (0)4 67 54 84 14
<a class=3D"moz-txt-link-abbreviated"
href=3D"mailto:blanchet@abes.fr">bl=
anchet(a)abes.fr</a> </pre
</body
</html
--------------97F06AFCAFA52500BDCD4A3E--