fix(runtime): migrate roles to nested system fields
This commit is contained in:
@@ -2,24 +2,6 @@
|
||||
- name: Deploy VM on Proxmox
|
||||
delegate_to: localhost
|
||||
vars:
|
||||
virtualization_dns_value: "{{ system_cfg.dns_servers if system_cfg.dns_servers is defined else '' }}"
|
||||
virtualization_dns_list_raw: >-
|
||||
{{
|
||||
virtualization_dns_value
|
||||
if virtualization_dns_value is iterable and virtualization_dns_value is not string
|
||||
else virtualization_dns_value.split(',')
|
||||
}}
|
||||
virtualization_dns_list: >-
|
||||
{{ virtualization_dns_list_raw | map('trim') | reject('equalto', '') | list }}
|
||||
virtualization_search_value: "{{ system_cfg.dns_search if system_cfg.dns_search is defined else '' }}"
|
||||
virtualization_search_list_raw: >-
|
||||
{{
|
||||
virtualization_search_value
|
||||
if virtualization_search_value is iterable and virtualization_search_value is not string
|
||||
else virtualization_search_value.split(',')
|
||||
}}
|
||||
virtualization_search_list: >-
|
||||
{{ virtualization_search_list_raw | map('trim') | reject('equalto', '') | list }}
|
||||
virtualization_proxmox_scsi: >-
|
||||
{%- set out = {} -%}
|
||||
{%- for disk in system_cfg.disks -%}
|
||||
@@ -30,16 +12,16 @@
|
||||
api_host: "{{ hypervisor_cfg.url }}"
|
||||
api_user: "{{ hypervisor_cfg.username }}"
|
||||
api_password: "{{ hypervisor_cfg.password }}"
|
||||
ciuser: "{{ user_name }}"
|
||||
cipassword: "{{ user_password }}"
|
||||
ciuser: "{{ system_cfg.user.name }}"
|
||||
cipassword: "{{ system_cfg.user.password }}"
|
||||
ciupgrade: false
|
||||
node: "{{ hypervisor_cfg.node }}"
|
||||
node: "{{ hypervisor_cfg.host }}"
|
||||
vmid: "{{ system_cfg.id }}"
|
||||
name: "{{ hostname }}"
|
||||
cpu: host
|
||||
cores: "{{ system_cfg.cpus }}"
|
||||
memory: "{{ system_cfg.memory_mb }}"
|
||||
balloon: "{{ system_cfg.balloon_mb if system_cfg.balloon_mb is defined and system_cfg.balloon_mb | int > 0 else omit }}"
|
||||
memory: "{{ system_cfg.memory }}"
|
||||
balloon: "{{ system_cfg.balloon if system_cfg.balloon is defined and system_cfg.balloon | int > 0 else omit }}"
|
||||
numa_enabled: true
|
||||
hotplug: network,disk
|
||||
update: "{{ virtualization_tpm2_enabled | bool }}"
|
||||
@@ -75,8 +57,8 @@
|
||||
if system_cfg.ip is defined and system_cfg.ip | string | length
|
||||
else 'ip=dhcp'
|
||||
}}
|
||||
nameservers: "{{ virtualization_dns_list if virtualization_dns_list | length else omit }}"
|
||||
searchdomains: "{{ virtualization_search_list if virtualization_search_list | length else omit }}"
|
||||
nameservers: "{{ system_cfg.dns.servers if system_cfg.dns.servers | length else omit }}"
|
||||
searchdomains: "{{ system_cfg.dns.search if system_cfg.dns.search | length else omit }}"
|
||||
onboot: true
|
||||
state: present
|
||||
|
||||
@@ -86,7 +68,7 @@
|
||||
api_host: "{{ hypervisor_cfg.url }}"
|
||||
api_user: "{{ hypervisor_cfg.username }}"
|
||||
api_password: "{{ hypervisor_cfg.password }}"
|
||||
node: "{{ hypervisor_cfg.node }}"
|
||||
node: "{{ hypervisor_cfg.host }}"
|
||||
name: "{{ hostname }}"
|
||||
vmid: "{{ system_cfg.id }}"
|
||||
state: started
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
state: "{{ 'poweredoff' if virtualization_tpm2_enabled | bool else 'poweredon' }}"
|
||||
disk: "{{ virtualization_vmware_disks }}"
|
||||
hardware:
|
||||
memory_mb: "{{ system_cfg.memory_mb }}"
|
||||
memory_mb: "{{ system_cfg.memory }}"
|
||||
num_cpus: "{{ system_cfg.cpus }}"
|
||||
boot_firmware: efi
|
||||
secure_boot: false
|
||||
|
||||
@@ -5,12 +5,8 @@ network:
|
||||
match:
|
||||
macaddress: "{{ virtualization_mac_address }}"
|
||||
{% set has_static = system_cfg.ip is defined and system_cfg.ip | string | length %}
|
||||
{% set dns_value = system_cfg.dns_servers if system_cfg.dns_servers is defined else '' %}
|
||||
{% set dns_list_raw = dns_value if dns_value is iterable and dns_value is not string else dns_value.split(',') %}
|
||||
{% set dns_list = dns_list_raw | map('trim') | reject('equalto', '') | list %}
|
||||
{% set search_value = system_cfg.dns_search if system_cfg.dns_search is defined else '' %}
|
||||
{% set search_list_raw = search_value if search_value is iterable and search_value is not string else search_value.split(',') %}
|
||||
{% set search_list = search_list_raw | map('trim') | reject('equalto', '') | list %}
|
||||
{% set dns_list = system_cfg.dns.servers | default([]) %}
|
||||
{% set search_list = system_cfg.dns.search | default([]) %}
|
||||
{% if has_static %}
|
||||
addresses:
|
||||
- "{{ system_cfg.ip }}/{{ system_cfg.prefix }}"
|
||||
@@ -19,12 +15,12 @@ network:
|
||||
{% endif %}
|
||||
{% else %}
|
||||
dhcp4: true
|
||||
{% if (system_cfg.dns_servers is defined and system_cfg.dns_servers | length) or (system_cfg.dns_search is defined and system_cfg.dns_search | length) %}
|
||||
{% if dns_list | length or search_list | length %}
|
||||
dhcp4-overrides:
|
||||
{% if system_cfg.dns_servers is defined and system_cfg.dns_servers | length %}
|
||||
{% if dns_list | length %}
|
||||
use-dns: false
|
||||
{% endif %}
|
||||
{% if system_cfg.dns_search is defined and system_cfg.dns_search | length %}
|
||||
{% if search_list | length %}
|
||||
use-domains: false
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -4,9 +4,9 @@ ssh_pwauth: true
|
||||
package_update: false
|
||||
package_upgrade: false
|
||||
users:
|
||||
- name: "{{ user_name }}"
|
||||
primary_group: "{{ user_name }}"
|
||||
- name: "{{ system_cfg.user.name }}"
|
||||
primary_group: "{{ system_cfg.user.name }}"
|
||||
groups: users
|
||||
sudo: ALL=(ALL) NOPASSWD:ALL
|
||||
passwd: "{{ user_password | password_hash('sha512') }}"
|
||||
passwd: "{{ system_cfg.user.password | password_hash('sha512') }}"
|
||||
lock_passwd: False
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<domain type='kvm'>
|
||||
<name>{{ hostname }}</name>
|
||||
<memory>{{ system_cfg.memory_mb | int * 1024 }}</memory>
|
||||
{% if system_cfg.balloon_mb is defined and system_cfg.balloon_mb | int > 0 %}<currentMemory>{{ system_cfg.balloon_mb | int * 1024 }}</currentMemory>{% endif %}
|
||||
<memory>{{ system_cfg.memory | int * 1024 }}</memory>
|
||||
{% if system_cfg.balloon is defined and system_cfg.balloon | int > 0 %}<currentMemory>{{ system_cfg.balloon | int * 1024 }}</currentMemory>{% endif %}
|
||||
<vcpu placement='static'>{{ system_cfg.cpus }}</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine="pc-q35-8.0">hvm</type>
|
||||
|
||||
Reference in New Issue
Block a user