ansible ovirt module

587 views
Skip to first unread message

Piet83

unread,
Jul 24, 2014, 4:26:02 AM7/24/14
to ansible...@googlegroups.com
Hello,

I'm trying to setup vm provisioning for Rhev with the ansible ovirt module. I have installed ovirt-engine-sdk-python-3.4.0.7-1.el6.noarch on my Centos 6.5 Ansible server and created a simple playbook to play around with this. The playbook tries to provision a vm based on a template defined within the Rhev manager:


---
- hosts: localhost

  tasks
:
 
- name: create vm based on template
    ovirt
: user=admin@internal url=https://rhevm.domain.nl/ instance_name=ansibletest2 password=xxxxxxxxxx image=Ubuntu_template zone=datacenter_default resource_type=new


When I run this play book I get the following output:

ansible-playbook -v create_vm.yml
 
PLAY
[localhost] **************************************************************

GATHERING FACTS
***************************************************************
ok
: [localhost]

TASK
: [create vm] *************************************************************
failed
: [localhost] => {"failed": true, "parsed": false}
invalid output was
: Traceback (most recent call last):
 
File "/root/.ansible/tmp/ansible-tmp-1406189516.72-109759934250973/ovirt", line 1642, in <module>
    main
()
 
File "/root/.ansible/tmp/ansible-tmp-1406189516.72-109759934250973/ovirt", line 379, in main
   
if get_vm(c, vmname) == "empty":
 
File "/root/.ansible/tmp/ansible-tmp-1406189516.72-109759934250973/ovirt", line 311, in get_vm
    vm
= conn.vms.get(name=vmname)
 
File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 18940, in get
    headers
={"All-Content":all_content}
 
File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 58, in get
   
return self.request(method='GET', url=url, headers=headers)
 
File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 118, in request
    persistent_auth
=self._persistent_auth)
 
File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 140, in __doRequest
    persistent_auth
=persistent_auth
 
File "/usr/lib/python2.6/site-packages/ovirtsdk/web/connection.py", line 134, in doRequest
   
raise RequestError, response
ovirtsdk
.infrastructure.errors.RequestError:
status
: 401
reason
: Unauthorized
detail
: JBWEB000065: HTTP Status 401


FATAL
: all hosts have already failed -- aborting

On the rhev manager server I see the following output in the /var/log/ovirt-engine/engine.log:

2014-07-24 10:21:42,769 INFO  [org.ovirt.engine.core.bll.LoginUserCommand] (ajp-/127.0.0.1:8702-7) Running command: LoginUserCommand internal: false.
2014-07-24 10:21:42,783 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (ajp-/
127.0.0.1:8702-7) Correlation ID: null, Call Stack: null, Custom Event ID: -1, Message: User admin logged in.

It seems to logon to the rhev api but sill I'm getting a 401 Unauthorized message when using the ansible ovirt module.
Is there someone who can help me resolve this?

Michael DeHaan

unread,
Jul 24, 2014, 7:10:34 AM7/24/14
to ansible...@googlegroups.com
Are their any ovirt users that would like to help with this one?









--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/47a76152-fe0f-4734-b390-69470a604947%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vincent Van der Kussen

unread,
Jul 24, 2014, 7:49:37 AM7/24/14
to ansible...@googlegroups.com
I might have a look at this. Not sure if the API has changed over time.
I still have a RHEV setup running where I can test on

Regards,
Vincent
> https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyrNkSGjXq6iDKeMCuADdRjuZHtd7RCnt%3DdfCPLr0cp%3DQ%40mail.gmail.com.

Piet83

unread,
Jul 24, 2014, 8:31:29 AM7/24/14
to ansible...@googlegroups.com
That would be very much appreciated. Ansible is awesome.

If I need to provide more info please let me know.

Regards,

Peter

Op donderdag 24 juli 2014 13:49:37 UTC+2 schreef Vincent Van der Kussen:

Piet83

unread,
Aug 13, 2014, 6:49:30 AM8/13/14
to ansible...@googlegroups.com
I was wondering if you had the chance looking in to this already? Just curious. 

Op donderdag 24 juli 2014 13:49:37 UTC+2 schreef Vincent Van der Kussen:
I might have a look at this. Not sure if the API has changed over time.

Karl E. Jorgensen

unread,
Aug 13, 2014, 8:01:11 AM8/13/14
to ansible...@googlegroups.com
Hi

We are using ansible internally (unofficially, as the company
standard-which-must-be-followed-regardless is puppet, but that is a
different story), and I ended up re-writing the ovirt module quite a
bit - the existing ovirt module had several problems:

- Error reporting was... not really working

- Support for quotas wasn't there

- Getting information about servers to start VNC console would be nice

and in general, I was not too happy with the code.

Perhaps this will be useful for others? It has only been tested in
our own environment, against one version of RHEV, so it is probably
not ready for prime time yet..

I probably have to approach the legal department here for this,
they're quite touchy about "IP rights" and stuff like that - advice
for this will be appreciated too. I realise this part is outside the
remit of this mailing list, but pointers in the right direction will
be appreciated.
> > For more options, visit https://groups.google.com/d/optout.
>

--
Karl E. Jorgensen

Michael DeHaan

unread,
Aug 13, 2014, 8:34:32 AM8/13/14
to ansible...@googlegroups.com
I'd be very interested in a pull request if you'd like to send it along.

My outside understanding was ovirt was starting to taper off in favor of Red Hat investing more in OpenStack, but there's no reason the module can't be updated for sure.

(Also, that might not be entirely correct...)

--Michael


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Message has been deleted

Michael DeHaan

unread,
Aug 13, 2014, 9:11:31 AM8/13/14
to ansible...@googlegroups.com
This is indeed why I want to see Karl's module upgrades.

Best way would be via a pull request, on top of the existing module if possible.




On Wed, Aug 13, 2014 at 8:57 AM, Piet83 <petersma...@gmail.com> wrote:
I'd be very interested in testing your "improved" ovirt module but the standard ovirt module isn't working for us in total. See my first post.

@Michael, we are using RHEV (commercial ovirt) in production to run VM for our customers with special setups. The environment is only growing and growing and it would be pretty awesome if Ansible could provision the virtual machines and configures them afterwards.

Op woensdag 13 augustus 2014 14:01:11 UTC+2 schreef Karl Jorgensen:

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Vincent Van der Kussen

unread,
Aug 13, 2014, 10:42:58 AM8/13/14
to ansible...@googlegroups.com

Hi,

Just returned from Holiday abroad. I hope to have a look at it in the next few days.

Which version of oVirt are you using and do you by any chance now about changes in the api, because the module worked perfectly on the version we used (3.1).

Regards,
Vincent

Peter Smallegange

unread,
Aug 14, 2014, 3:37:33 AM8/14/14
to ansible...@googlegroups.com
Hello,

Hope you had a good holiday :) My holiday starts this Friday luckily. 

These are the versions we use:

Red Hat Enterprise Virtualization Manager Version: 3.4.1-0.31.el6ev

ansible: 1.6.6

module: ovirt
author: Vincent Van der Kussen
short_description: oVirt/RHEV platform management
description:
    - allows you to create new instances, either from scratch or an image, in addition to deleting or stopping instances on the oVirt/RHEV platform
version_added: "1.4"


What I do know is that there is also a problem with the rhevm/ovirt iso up loader which also uses the API.



--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/q_fghQC8EIk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

Vincent Van der Kussen

unread,
Aug 19, 2014, 3:11:40 AM8/19/14
to ansible...@googlegroups.com
Hi,

I just tested this from an Ubuntu machine with version 3.4.3.0 of the
SDK. Seems to be working just fine.


$ cat play.yml
- hosts: localhost
tasks:
- name: create vm based on template
ovirt: user=admin@internal url=https://rhevm30.bla.local:8443
instance_name=ansibletest password=xxxxxxx image=CentOS6.4-minimal
zone=production resource_type=template


vincent@bumblebee in ~/tmp
$ ansible-playbook -c local play.yml

PLAY [localhost] **************************************************************

GATHERING FACTS ***************************************************************
ok: [localhost]

TASK: [create vm based on template] *******************************************
changed: [localhost]

PLAY RECAP ********************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0

vincent@bumblebee in ~/tmp

Can you try to login in the gui with the credentials provided in your
playbook? Does that work?

Regards,
Vincent
> https://groups.google.com/d/msgid/ansible-project/CAAfDr1uT18keHRPu%3DDjouSi-ALamRreQvrMtWHzsAsQAf7h5Pg%40mail.gmail.com.

Piet83

unread,
Sep 11, 2014, 8:12:43 AM9/11/14
to ansible...@googlegroups.com
Hello,

In my playbook I had "resource_type=template"  which should be "resource_type=new" as shown in your example. So now it works, I can provision a vm with Ansible!! Awesomeness!!

Thank you for your help.




Op dinsdag 19 augustus 2014 09:11:40 UTC+2 schreef Vincent Van der Kussen:

Piet83

unread,
Nov 10, 2014, 6:30:32 AM11/10/14
to ansible...@googlegroups.com
Hello,

When deploying from a template with the ovirt module it creates the vm with the specs that are defined within the template. Is it possible to adjust the specs when provisioning with the ovirt module? So, is it possible to give more cpu, mem or an other instanc_network to a vm provisioned form template  with the Ansible ovirt module?

I've tried this without success.

Vincent Van der Kussen

unread,
Nov 10, 2014, 7:45:08 AM11/10/14
to ansible...@googlegroups.com

Hi,

I don't know If this can be done on deployment of the template.

An option might be to deploy your template and then alter the resource settings one it's available. But this should be added to the module.

I currently don't have access to a rhev/ovirt setup to see what has changed in the API.

Vincent

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
Message has been deleted

Piet83

unread,
Nov 14, 2014, 5:13:17 AM11/14/14
to ansible...@googlegroups.com

Hey Vincent,

Thank you for your answer. I would be great to alter the vm settings with your module but I don't see anything about it in the API documentation either:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.0/html-single/REST_API_Guide/

For now I will try to get the mac address of the created vm through an API call and try to configure the vm with tftp boot and kickstart.

Peter  
Op maandag 10 november 2014 13:45:08 UTC+1 schreef Vincent Van der Kussen:
Reply all
Reply to author
Forward
0 new messages