Re: [ovirt-users] ansible and list of vms

2017-05-12 Thread Ondra Machacek
This worked for me: --- - hosts: localhost connection: local vars_files: - ../vars.yml tasks: - name: Obtain SSO token ovirt_auth: url: "{{ url }}" username: "{{ username }}" password: "{{ password }}" insecure: "{{ insecure }}" - name: List vms

Re: [ovirt-users] ansible and list of vms

2017-05-12 Thread Nathanaël Blanchet
Great, it works like a charm! But how could I obtain a several map display? For example, I need to display the vm name ; its relative snaphost id and snaphot description. I tried to change filter, but notyhing works msg: "{{ ovirt_snapshots | map(attribute='description') |

Re: [ovirt-users] ansible and list of vms

2017-05-11 Thread Ondra Machacek
I am not Ansible expert, this maybe worth asking on Ansible users list, but one thing which you can do is following: in tasks/main.yml - include: "{{ item }}" with_items: "{{ resources | default('vms') }}.yml" then have following files: - tasks/vms.yml - tasks/clusters.yml -

Re: [ovirt-users] ansible and list of vms

2017-05-11 Thread Nathanaël Blanchet
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 }}"

Re: [ovirt-users] ansible and list of vms

2017-05-10 Thread Ondra Machacek
On Wed, May 10, 2017 at 12:38 PM, Nathanaël Blanchet wrote: > Le 10/05/2017 à 10:29, Ondra Machacek a écrit : > > 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

Re: [ovirt-users] ansible and list of vms

2017-05-10 Thread Nathanaël Blanchet
Le 10/05/2017 à 10:29, Ondra Machacek a écrit : 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:

Re: [ovirt-users] ansible and list of vms

2017-05-10 Thread Ondra Machacek
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 username:

Re: [ovirt-users] ansible and list of vms

2017-05-10 Thread Nathanaël Blanchet
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 à 07:56, Ondra Machacek a écrit : On Tue, May

Re: [ovirt-users] ansible and list of vms

2017-05-09 Thread Ondra Machacek
On Tue, May 9, 2017 at 6:52 PM, Nathanaël Blanchet 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

[ovirt-users] ansible and list of vms

2017-05-09 Thread Nathanaël Blanchet
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",