You are absolutely right Ondra. Thank You

I have three questions for you:

1) How does this work ? Ansible creates the configuration disk?

2) How can I do to disable cloud-init after execution, maybe a script that runs systemd disable cloud-init.service and systemd mask cloud-init.service. There is little documentation about it

3) If you would like to turn off or on a huge set of virtual machines how you can group them to do so. Without having to do a Task for each one

2017-09-11 4:25 GMT-05:00 Ondra Machacek <omachace@redhat.com>:
On Sat, Sep 9, 2017 at 2:02 AM, Julián Tete <danteconrad14@gmail.com> wrote:
> oVirt Version: 4.1.5
>
> Ansible: 2.3.1
>
> Hello Friends of oVirt
>
> I want to automate the creation, provisioning and deployment of virtual
> machines in oVirt, using Ansible.
>
> I want to use a non-cloud image for the template. It has cloud-init
> installed. And it looks for the IP http: //169.254.169 and the following
> error message: "Calling 'http: //169.254.169 ....."
>
> It looks like oVirt uses a config drive with a user-data.txt file
>
> This is my Ansible Playbook:
>
> ---
> # Primer Play
> - hosts: oVirtEnginePruebas
>   remote_user: root
>   tasks:
>     - name : Definiendo la conexion con el Engine de oVirt
>       ovirt_auth:
>           url: https://engine1.example.com/ovirt-engine/api
>           username: admin@internal
>           password: mysupersecretpassword
>           ca_file: /etc/pki/ovirt-engine/ca.pem
>
>     - name : Creando la maquina virtual requerida
>       ovirt_vms:
>           auth: "{{ ovirt_auth }}"
>           state: present
>           name: CentOS7CloudInit
>           template: CloudInitTemplate
>           cluster: Default

Why you need this? I think you can remove and use just the task below.

>
>     - name : Se establecen las propiedades de la maquina virtual y los
> parametros de cloud-init
>       ovirt_vms:
>           auth: "{{ ovirt_auth }}"
>           name: CentOS7CloudInit
>           template: CloudInitTemplate
>           cluster: Default
>           memory: 5GiB
>           cpu_cores: 8
>           high_availability: true
>           cloud_init:
>             host_name: cloudinit.example.com
>             nic_name: eth0
>             nic_boot_protocol: static
>             nic_ip_address: 192.168.0.238
>             nic_netmask: 255.255.255.0
>             nic_gateway: 192.168.0.1
>             dns_servers: 8.8.8.8
>             dns_search: example.com
>             nic_on_boot: true
>             user_name: root
>             root_password: mysupersecretpassword

This looks OK, and should work, what is the issue you have?

>
>     - name : Desconectando con el Engine de oVirt revocando el token SSO
>       ovirt_auth:
>           state: absent
>           ovirt_auth: "{{ ovirt_auth }}"
> ~
>
>
> I just want to use Ansible for this, I do not want to use the oVirt
> webinterface to run run once every time I want to provision a machine.
>
> How can I do that ?
>
> Thanks in advance
>
> _______________________________________________
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>