-
Notifications
You must be signed in to change notification settings - Fork 2
/
cloud_init.yml
59 lines (51 loc) · 1.53 KB
/
cloud_init.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
- hosts: srv
become: true
vars_files:
- ./variable.yml
vars_prompt:
- name: VMID_cloud
prompt: "Masukkan VMID yang diinginkan: "
private: no
tasks:
- name: Update apt PVE Node
apt:
update: yes
update_cache: yes
- name: Install dependensi PVE node
apt:
name:
- build-essential
- python-dev
- python-pip
state: present
- name: Konfigurasi pip PVE node
pip:
name: proxmoxer
- name: Download Template cloud init
get_url:
url: https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img
dest: /root
- name: Pembuatan VM kosong
community.general.proxmox_kvm:
api_user: "{{ user }}"
api_password: "{{ password }}"
api_host: "{{ PVE_node }}"
name: cloudinit
vmid: "{{ VMID_cloud }}"
node: "{{ node }}"
net:
net0: 'virtio,bridge=vmbr0,rate=200'
- name: Import disk ke HDD-1
command: qm importdisk "{{ VMID_cloud }}" bionic-server-cloudimg-amd64.img HDD-1
register: import_output
- debug:
var: import_output.stdout_lines
- name: Attach disk
command: qm set "{{ VMID_cloud }}" --scsihw virtio-scsi-pci --scsi0 HDD-1:"{{ VMID_cloud }}"/vm-"{{ VMID_cloud }}"-disk-0.raw
register: import_attach
- debug:
var: import_attach.stdout_lines
- name: Konfigurasi CD-ROM
command: qm set "{{ VMID_cloud }}" --ide2 HDD-1:cloudinit
- name: Setting boot ke scsi0
command: qm set "{{ VMID_cloud }}" --boot c --bootdisk scsi0