-
Notifications
You must be signed in to change notification settings - Fork 1
/
ansible-virt-install.j2
32 lines (29 loc) · 1.4 KB
/
ansible-virt-install.j2
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
#!/bin/bash
{% if kvm_guest_bridge == True %}
{% set kvm_guest_network = 'bridge=' + kvm_host_bridge %}
{% else %}
{% set kvm_guest_network = 'network=' + kvm_guest_default_net %}
{% endif %}
virt-install \
--name {{ inventory_hostname }} \
--vcpus {{ kvm_guest_vcpus }} \
--memory memory={{ kvm_guest_memory }},maxmemory={{ (kvm_guest_memory * 2) | int }} \
--disk path=/var/lib/libvirt/images/{{ inventory_hostname}}.qcow2,size={{ kvm_guest_disk_size }},format=qcow2,device=disk,bus=virtio,cache=none \
--nographics \
--network {{ kvm_guest_network }},model=virtio \
--hvm --accelerate \
--autostart --wait=-1 \
--noautoconsole \
--initrd-inject=/var/lib/libvirt/local-kickstarts/{{ inventory_hostname }}.cfg \
{% if 'ppc64le' in inventory_hostname or 'power9' in inventory_hostname %}
--extra-args "console=hvc0 console=hvc1 net.ifnames=0 ks=file:/{{ inventory_hostname }}.cfg" \
{% else %}
--extra-args "console=ttyS0 net.ifnames=0 inst.ks=file:/{{ inventory_hostname }}.cfg" \
{% endif %}
{% if centos_dist == 7 or centos_dist == '8-stream' %}
--location http://qa.centos.org/centos/{{ centos_dist }}/BaseOS/{{ centos_arch }}/os/
{% elif centos_dist == '9-stream' %}
--location https://composes.stream.centos.org/production/latest-CentOS-Stream/compose/BaseOS/{{ centos_arch }}/os/
{% else %}
--location http://qa.centos.org/centos/{{ centos_dist }}/os/{{ centos_arch }}/
{% endif %}