Add support for datadisk type

This commit is contained in:
Timo Makinen 2022-08-13 17:34:34 +00:00
parent 4de72ed215
commit b1036de33d
20 changed files with 40 additions and 31 deletions

View file

@ -1,7 +1,6 @@
--- ---
datadisks: datadisks:
- 10 - {size: 10}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 10 - {size: 10}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,7 +1,6 @@
--- ---
datadisks: datadisks:
- 10 - {size: 10}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 100 - {size: 100}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 100 - {size: 100}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 50 - {siez: 50}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 10 - {size: 10}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,7 +1,7 @@
--- ---
mem_size: 4096 mem_size: 4096
datadisks: datadisks:
- 100 - {size: 100}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}
- {proto: tcp, port: 4949, from: [172.20.30.0/24]} - {proto: tcp, port: 4949, from: [172.20.30.0/24]}

View file

@ -1,7 +1,7 @@
--- ---
datadisks: datadisks:
- 1000 - {size: 1000}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 20 - {size: 20}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}
- {proto: tcp, port: 27017, from: [172.20.20.0/22]} - {proto: tcp, port: 27017, from: [172.20.20.0/22]}

View file

@ -1,10 +1,7 @@
--- ---
# more cpu to create graphs
num_cpus: 4 num_cpus: 4
datadisks: datadisks:
- 10 - {size: 10}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,9 +1,9 @@
--- ---
mem_size: 8192
mem_size: 4096
num_cpus: 2 num_cpus: 2
datadisks: datadisks:
- 1000 - {size: 1000}
- {size: 400, type: nvme}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 10 - {size: 10}
network_vip_interfaces: network_vip_interfaces:
- device: eth1 - device: eth1

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 20 - {size: 20}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}
- {proto: tcp, port: 3306, from: [172.20.20.0/22]} - {proto: tcp, port: 3306, from: [172.20.20.0/22]}

View file

@ -1,6 +1,6 @@
--- ---
datadisks: datadisks:
- 10 - {size: 10}
firewall_in: firewall_in:
- {proto: tcp, port: 22, from: [172.20.20.0/22]} - {proto: tcp, port: 22, from: [172.20.20.0/22]}
- {proto: tcp, port: 443} - {proto: tcp, port: 443}

View file

@ -1,8 +1,8 @@
--- ---
datadisks:
- 500
mem_size: 4096 mem_size: 4096
num_cpus: 2 num_cpus: 2
datadisks:
- {size: 500}
network_vip_interfaces: network_vip_interfaces:
- device: eth1 - device: eth1

View file

@ -5,6 +5,6 @@ network_interfaces:
vlan: 20 vlan: 20
mac: 52:54:00:ac:dc:50 mac: 52:54:00:ac:dc:50
datadisks: datadisks:
- 1000 - {size: 1000}
passthrough_devices: passthrough_devices:
- "07:04.0" - "07:04.0"

View file

@ -5,6 +5,6 @@ network_interfaces:
vlan: 20 vlan: 20
mac: 52:54:00:ac:dc:1f mac: 52:54:00:ac:dc:1f
datadisks: datadisks:
- 10 - {size: 10}
ldap_master: true ldap_master: true

View file

@ -11,7 +11,6 @@
console_log: "/var/log/libvirt/qemu/{{ inventory_hostname }}.console.log" console_log: "/var/log/libvirt/qemu/{{ inventory_hostname }}.console.log"
os_disk_image: "/srv/libvirt/ssd/{{ inventory_hostname }}.a.img" os_disk_image: "/srv/libvirt/ssd/{{ inventory_hostname }}.a.img"
dsk_opts: bus=virtio,cache=none,device=disk,format=raw dsk_opts: bus=virtio,cache=none,device=disk,format=raw
base: /srv/libvirt/hdd/{{ inventory_hostname }}
inject: >- inject: >-
{% if not '--cdrom' in virt_install_os_args %}{{ true }}{% endif %} {% if not '--cdrom' in virt_install_os_args %}{{ true }}{% endif %}
@ -19,7 +18,13 @@
virt_install_disks: >- virt_install_disks: >-
{% if datadisks is defined %} {% if datadisks is defined %}
{% for i in range(datadisks|count) %} {% for i in range(datadisks|count) %}
--disk {{ base }}.{{ char[i] }}.img,{{ dsk_opts }},size={{ datadisks[i] }},sparse=no {% if datadisks[i].type is defined %}
{% set type = datadisks[i].type %}
{% else %}
{% set type = "hdd" %}
{% endif %}
{% set base = "/srv/libvirt/" + type + "/" + inventory_hostname %}
--disk {{ base }}.{{ char[i] }}.img,{{ dsk_opts }},size={{ datadisks[i].size }},sparse=no
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View file

@ -9,10 +9,19 @@
vars_files: vars_files:
- "{{ ansible_private }}/vars.yml" - "{{ ansible_private }}/vars.yml"
pre_tasks: pre_tasks:
- name: mount /export - name: mount /export/home
mount: mount:
name: /export name: /export/home
src: LABEL=/export src: LABEL=home
fstype: xfs
opts: noatime
passno: "0"
dump: "0"
state: mounted
- name: mount /export/roles
mount:
name: /export/roles
src: LABEL=roles
fstype: xfs fstype: xfs
opts: noatime opts: noatime
passno: "0" passno: "0"