Skip to content
Snippets Groups Projects
Verified Commit c7c222e6 authored by Felix Schäfer's avatar Felix Schäfer :construction_worker:
Browse files

Automatically determine bridge from configured IPs

parent 90e6cba3
No related branches found
No related tags found
1 merge request!4Automatically determine bridge from configured IPs
Pipeline #293560 passed
......@@ -45,6 +45,22 @@
ansible.builtin.set_fact:
proxmox_vm_ipconfig_list: "{{ proxmox_vm_ipconfig is string | ternary([proxmox_vm_ipconfig], proxmox_vm_ipconfig) }}" # noqa yaml[line-length]
- name: "Collect subnets configured for this VM ({{ proxmox_vm_name }})"
ansible.builtin.set_fact:
proxmox_vm_net_list: >-
{{
proxmox_vm_ipconfig |
map('split', ',') |
flatten |
select('match', 'ip*') |
map('regex_replace', '^ip6?=', '') |
map('ansible.utils.ipaddr', 'subnet') |
map('extract', proxmox_vm_net_to_bridge) |
unique |
map('replace', '', 'bridge=', 1)
}}
when: proxmox_vm_net is undefined and proxmox_vm_net_to_bridge is defined
- name: "Create new VM ({{ proxmox_vm_name }})"
when: proxmox_vm_name not in proxmox_vm_existing
ansible.builtin.include_tasks: create_vm.yml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment