-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmake-25-vms.yml
75 lines (71 loc) · 1.71 KB
/
make-25-vms.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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