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

Julián Tete danteconrad14 at gmail.com
Sat Sep 9 00:02:40 UTC 2017


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

    - 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

    - 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20170908/d8a9e7db/attachment.html>


More information about the Users mailing list