-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook-vm-idm.yml
41 lines (36 loc) · 1.37 KB
/
playbook-vm-idm.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
- name: Provision IdM node
hosts: pve
become: true
vars: { pve_host: localhost }
tasks:
- include_tasks: tasks/setup_proxmox_api.yml
- include_tasks: tasks/copy_bos_image.yml
vars: { arch: x86_64 }
- name: Copy idm BOS image
ansible.builtin.copy:
src: /var/lib/vz/template/bos.x86_64.qcow2
dest: "/var/lib/vz/template/bos.x86_64.{{idm_disk_size}}.qcow2"
force: false
remote_src: true
- name: Resize idm image
ansible.builtin.shell: "qemu-img resize bos.x86_64.{{idm_disk_size}}.qcow2 {{idm_disk_size}}"
args:
chdir: /var/lib/vz/template/
- include_tasks: tasks/pve_create_vm.yml
vars:
vm_name: "idm.{{domain}}"
vm_cores: "{{idm_ncores}}"
vm_mem_gb: "{{idm_mem_gb}}"
vm_sshkeys: "{{idm_sshkeys}}"
vm_user: "root"
vm_password: "{{idm_password}}"
vm_nameservers: "{{router_ip}}"
vm_ipconfig:
ipconfig0: "gw={{router_ip}},ip={{idm_ip}}/24"
vm_net:
net0: "virtio,bridge=vmbr1"
vm_scsi:
scsi0: "{{storage_pool}}:0,import-from=/var/lib/vz/template/bos.x86_64.{{idm_disk_size}}.qcow2,format={{disk_format}},cache=none,ssd=1,discard=on"
- include_tasks: tasks/pve_vm_state.yml
vars: { vm_name: "idm.{{domain}}", vm_state: started }
- include_tasks: tasks/delete_image_templates.yml