cloud profiles and providers. libvirt net setup

This commit is contained in:
m0duspwnens
2024-08-13 10:17:45 -04:00
parent f9eeb76518
commit aa5de9f7bd
6 changed files with 42 additions and 14 deletions

View File

@@ -53,13 +53,18 @@ install_qemu:
pkg.installed:
- name: qemu-kvm
install_libguestfs:
pkg.installed:
- name: libguestfs
create_host_bridge:
virt.network_running:
- name: host-bridge
- bridge: br0
- forward: bridge
- autostart: True
install-guestfs-tools:
pkg.installed:
- name: guestfs-tools
disable_default_bridge:
cmd.run:
- name: virsh net-destroy default && virsh net-autostart default --disable
- require:
- pkg: install_libvirt-client
# this should only run during the first highstate after setup. it will transfer connection from mgmt to br0
down_original_mgmt_interface:

View File

@@ -11,6 +11,25 @@ install_libvirt-client:
pkg.installed:
- name: libvirt-client
# allows for creating vm images
# any node manipulating images needs this
install_qemu-img:
pkg.installed:
- name: qemu-img
install_guestfs-tools:
pkg.installed:
- name: guestfs-tools
install_xorriso:
pkg.installed:
- name: xorriso
install_virt-install:
pkg.installed:
- name: virt-install
###
libvirt_python_wheel:
file.recurse:
- name: /opt/so/conf/libvirt/source-packages/libvirt-python

View File

@@ -51,6 +51,6 @@ qemu_ssh_client_config:
soqemussh_pub_key:
ssh_auth.present:
- user: soqemussh
- source: salt://libvirt/ssh_keys/id_ed25519.pub
- source: salt://libvirt/ssh/keys/id_ed25519.pub
{% endif %}

View File

@@ -49,10 +49,11 @@ sensor:
sls_list:
- setHostname
{%- for hv in HYPERVISORS %}
{%- for node_type, hosts in HYPERVISORS.items() %}
{%- for host in hosts %}
core-{{hv}}:
provider: kvm-ssh-{{hv}}
core-{{host}}:
provider: kvm-ssh-{{host}}
base_domain: jppol9vm
ip_source: qemu-agent
ssh_username: onionuser
@@ -67,4 +68,5 @@ core-{{hv}}:
sls_list:
- setHostname
{%- endfor %}
{%- endfor %}

View File

@@ -3,12 +3,14 @@
# driver: libvirt
# url: qemu+ssh://soqemussh@jpphype1/system?socket=/var/run/libvirt/libvirt-sock
{%- for hv in HYPERVISORS %}
{%- for node_type, hosts in HYPERVISORS.items() %}
{%- for host in hosts %}
kvm-ssh-{{hv}}:
kvm-ssh-{{host}}:
driver: libvirt
url: qemu+ssh://soqemussh@{{hv}}/system?socket=/var/run/libvirt/libvirt-sock
url: qemu+ssh://soqemussh@{{host}}/system?socket=/var/run/libvirt/libvirt-sock
{%- endfor %}
{%- endfor %}
# Or connect to a local libvirt instance

View File

@@ -28,7 +28,7 @@ cloud_profiles:
- name: /etc/salt/cloud.profiles.d/socloud.conf
- source: salt://salt/cloud/cloud.profiles.d/socloud.conf.jinja
- defaults:
HYPERVISORS: {{pillar.hypervisor.nodes}}
HYPERVISORS: {{pillar.hypervisor.nodes.hypervisor}}
- template: jinja
{% else %}