-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_vm.yaml
79 lines (70 loc) · 1.65 KB
/
add_vm.yaml
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
76
77
78
79
# Copyright (C) 2020, RTE (http://www.rte-france.com)
# SPDX-License-Identifier: Apache-2.0
# Test VM creation.
# Prerequisite:
# - The cluster setup must be done
# - An OVS bridge without DPDK called ovsbr0 must be present on all hypervisors.
---
- hosts: hypervisors
name: Import os disk (this can be long).
vars:
- disk_path: guest.qcow2
- disk_name: os
- force: true
roles:
- seapath_import_vm_disk
- hosts: hypervisors
name: Create data disk
vars:
- disk_name: data0
- action: create
- size: 10
- size_unit: G
- force: true
roles:
- seapath_manage_disks
- hosts: hypervisors
name: Copy os disk
vars:
- disk_name: os
- new_disk: os0
- action: copy
- force: true
roles:
- seapath_manage_disks
- hosts: hypervisors
name: Create the test0 VM
vars:
- vm_name: test0
- state: create
- xml_template: "{{ lookup('env', 'PWD') }}/templates/votp_vm.xml.j2"
- rbd_pool: rbd
- os_disk: os0
- data_disk: data0
- ovs_br: ovsbr0
- ovs_port: 0
- activate: "no"
- mac_address: "52:54:11:11:64:94"
roles:
- seapath_vm_manage
- hosts: hypervisors
name: Store the configuration in disk metadata
tasks:
- shell:
cmd: 'rbd image-meta set rbd/os0 config_initial \
"$(cat /etc/pacemaker/test0.xml)"'
- hosts: hypervisors
name: Create os0 initial snapshot
vars:
- action: snapshot
- disk_name: os0
- new_disk: snapshot0
roles:
- seapath_manage_disks
- hosts: hypervisors
name: Enable test0 in Pacemaker
vars:
- vm_name: test0
- state: enable
roles:
- seapath_vm_manage