From b0b850f4c7d8659ae7e6c61bbe33786c2dd8e495 Mon Sep 17 00:00:00 2001 From: Mike Flannery Date: Thu, 27 Sep 2018 13:57:42 -0400 Subject: [PATCH] added make-25-vms.yml --- make-25-vms.yml | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 make-25-vms.yml diff --git a/make-25-vms.yml b/make-25-vms.yml new file mode 100644 index 0000000..f605388 --- /dev/null +++ b/make-25-vms.yml @@ -0,0 +1,75 @@ +# file: make-25-vms.yml +# +# prerequisites: +# NEW: sudo dnf install redhat-rpm-config python2-devel libxml2-devel libcurl-devel ; sudo easy_install ovirt-engine-sdk-python +# RPM: yum --enablerepo-rhel-7-server-rhv-4.2-manager-rpms install python-ovirt-engine-sdk4 +# +# execution: +# $ ansbile-playbook make-25-vms.yml + +--- +- hosts: localhost + gather_facts: no + + tasks: + - name: Login to RHV + ovirt_auth: + url: https://rhvm.cluster.net/ovirt-engine/api + insecure: yes + username: admin@internal + password: redhat1 + + - name: Create VMs + ovirt_vms: + auth: "{{ ovirt_auth }}" + cluster: Default + template: RHEL-7.5-Guest + name: "{{ item }}" + state: running + instance_type: Tiny + nics: + - name: nic1 + profile_name: ovirtmgmt + cloud_init: + host_name: "{{ item }}.cluster.net" + user_name: root + root_password: redhat1 + nic_name: eth0 + nic_on_boot: true + nic_boot_protocol: dhcp + + custom_script: | + runcmd: + - hostnamectl set-hostname {{ item }}.cluster.net + - yum -y remove cloud-init + wait: true + with_items: + - vm01 + - vm02 + - vm03 + - vm04 + - vm05 + - vm06 + - vm07 + - vm08 + - vm09 + - vm10 + - vm11 + - vm12 + - vm13 + - vm14 + - vm15 + - vm16 + - vm17 + - vm18 + - vm19 + - vm20 + - vm21 + - vm22 + - vm23 + - vm24 + - vm25 + - name: Cleanup RHV auth token + ovirt_auth: + ovirt_auth: "{{ ovirt_auth }}" + state: absent