Hi,

On 02/01/2017 04:06 PM, Ondra Machacek wrote:
On Wed, Feb 1, 2017 at 3:27 PM, Jiří Sléžka <jiri.sle...@slu.cz> wrote:
Hi Ondra,


I am testing oVirt ansible modules and I am stucked in this simple scenario.
I would like to create a new vm with new bootable disk attached to it.

I wrote this simple role for it

http://pastebin.com/XwwyCH4b

when I run it I got


$ ansible-playbook site.yml

PLAY [create ovirt vm]
*********************************************************

TASK [setup]
*******************************************************************
ok: [localhost]

TASK [create_vm : ovirt_auth]
**************************************************
ok: [localhost]

TASK [create_vm : ovirt_disks]
*************************************************
changed: [localhost]

TASK [create_vm : ovirt_vms]
***************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "msg":
"Fault reason is \"Operation Failed\". Fault detail is \"[Cannot run VM
without at least one bootable disk.\nAlternatives:\n- Create a disk for this
VM, and rerun the VM.\n- Change the boot sequence using the Edit VM command
(Boot Option Sub-Tab).\n- Use the 'Run Once' command to select a different
boot option and rerun the VM.]\". HTTP response code is 409."}
        to retry, use: --limit
@/home/dron/#work/#cit/ovirt/ansible/ovirt/site.retry

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


In the manager I can see the is disk successfully created, vm too, disk is
attached to vm but not activated.

When I activate it manually, I am able to run this vm.

Any ideas how can I achieve this via ansible?

Yes, this is bug which was fixed[1], but wasn't backported to 2.2.

But since you are using role you are good.
Just download lastest vms module[2] and put it into the library directory,
which you must create in your role, for example:

 $ mkdir roles/vm-create-role/library
 $ cd roles/vm-create-role/library
 $ wget 
https://raw.githubusercontent.com/ansible/ansible-modules-extras/devel/cloud/ovirt/ovirt_vms.py

yes, it is the way.

I have downloaded devel version of module, put it into library directory. It was correctly used by ansible but it failed with an error

"msg": "'NoneType' object has no attribute 'append'"

never mind, I will wait till Ansible 2.3 and then I'll try it once more.

Cheers,

Jiri


Then it should work OK, at least I think the modules in library has
higher priority.
If not then renaming that module should work, for example:

 $ mv ovirt_vms.py ovirt_vms_dev.py

and then use it as:

tasks:
  ...
  - name: Create vm
    ovirt_vms_dev:
      name: vm0
      ...

Btw. in ~month there should be Ansible 2.3 release, with has much more features,
and also will have this issue fixed.

[1] https://github.com/ansible/ansible-modules-extras/pull/3322
[2] 
https://raw.githubusercontent.com/ansible/ansible-modules-extras/devel/cloud/ovirt/ovirt_vms.py



Thanks in advance,

Jiri Slezka





On 12/02/2016 02:12 PM, Ondra Machacek wrote:

Hello all,

I would like to kindly ask everyone who is Ansible or oVirt user for
testing of the new Ansible oVirt modules. For everyone who is familiar
with the Ansible and oVirt, this[1] describes the steps you need to do,
to setup oVirt modules library and start using those modules (Most of
those modules will be available in Ansible 2.3, some of them are already
in 2.2).

If you have any issue setting this up, please contact me, I will do the
best to help you.

If you have an issue, which you think is a bug, please open an issue
here[2]. Please note that Ansible is merging it's repositories, so since
next week it will actually be stored here[3]. If you are missing
anything please open an issue as well, or just contact me, and I will
do fix it. You are also very welcome to sent PR with fixes.

For those who don't have testing environment which can test against,
I've created an Vagrant project which will deploy you the oVirt instance
using Ansible playbooks. You can find how to use it here[4].

The repository also contains few examples[5], so you don't have to
copy-paste them from the source.

Thanks all for reading this and any feedback,
Ondra

[1] https://github.com/machacekondra/ovirt-tests/releases/tag/0.1
[2] https://github.com/ansible/ansible-modules-extras/issues
[3] https://github.com/ansible/ansible
[4] https://github.com/machacekondra/ovirt-tests
[5] https://github.com/machacekondra/ovirt-tests/tree/master/examples
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users




_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users



Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users

Reply via email to