[ovirt-users] oVirt automation through Ansible and cloud-init in oVirt 4.1.5 + Ansible 2.3.1

Ondra Machacek omachace at redhat.com
Mon Sep 11 09:25:51 UTC 2017


On Sat, Sep 9, 2017 at 2:02 AM, Julián Tete <danteconrad14 at 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 at 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 at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>


More information about the Users mailing list