Gate scripts refactoring
Added flexible boot mode configuration for VMs based on BareMetalHost definition. Change-Id: I1332ff99e7ec539ac280efda515f736b7c18f459
This commit is contained in:
parent
35cdb66e78
commit
2605cd9159
@ -60,9 +60,9 @@
|
||||
- name: clone document model
|
||||
command: git clone -q {{ airship_config_primary_repo_url }} {{ remote_work_dir }}
|
||||
when: remote_work_dir is defined
|
||||
- name: get MACs from BareMetalHost objects
|
||||
- name: get VM config(MACs and bootMode) from BareMetalHost objects
|
||||
include_tasks:
|
||||
file: get-mac-addresses.yaml
|
||||
file: get-vm-config.yaml
|
||||
vars:
|
||||
name: "{{ roleinputvar.name }}"
|
||||
path: "{{ roleinputvar.path }}"
|
||||
@ -85,19 +85,19 @@
|
||||
name: "default"
|
||||
airship_gate_flavors:
|
||||
medium:
|
||||
target_vm_memory_mb: 4096
|
||||
target_vm_vcpus: 2
|
||||
disk_format: qcow2
|
||||
ephemeral_disk_size: 20G
|
||||
ephemeral_vm_cfg: "{{ ephemeral_vm_cfg }}"
|
||||
ephemeral_vm_memory_mb: 6124
|
||||
ephemeral_vm_vcpus: 4
|
||||
ephemeral_disk_size: 20G
|
||||
ephemeral_vm_nics: "{{ ephemeral_vm_nics }}"
|
||||
target_disk_size: 10G
|
||||
disk_format: qcow2
|
||||
target_vm_cfg: "{{ target_vm_cfg }}"
|
||||
target_vm_memory_mb: 4096
|
||||
target_vm_vcpus: 2
|
||||
target_vms_count: 1
|
||||
target_vm_nics: "{{ target_vm_nics }}"
|
||||
worker_disk_size: 10G
|
||||
worker_vm_memory_mb: 1024
|
||||
worker_vm_vcpus: 1
|
||||
worker_disk_size: 10G
|
||||
worker_vms_count: 1
|
||||
airship_gate_file_exchanger:
|
||||
servername: "localhost"
|
||||
|
@ -21,8 +21,10 @@
|
||||
environment:
|
||||
KUSTOMIZE_PLUGIN_HOME: "{{ ansible_env.HOME }}/.airship/kustomize-plugins"
|
||||
KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true"
|
||||
|
||||
- set_fact:
|
||||
bmh: "{{ bmh_command.stdout | from_yaml_all | list }}"
|
||||
|
||||
- name: get network configuration for BareMetalHost objects
|
||||
shell: |
|
||||
set -e
|
||||
@ -35,6 +37,7 @@
|
||||
KUSTOMIZE_PLUGIN_HOME: "{{ ansible_env.HOME }}/.airship/kustomize-plugins"
|
||||
KUSTOMIZE_ENABLE_ALPHA_COMMANDS: "true"
|
||||
with_items: "{{ bmh }}"
|
||||
|
||||
- name: get links from network data per BareMetalHost object
|
||||
set_fact:
|
||||
links: |
|
||||
@ -44,9 +47,10 @@
|
||||
map(attribute='stringData.networkData') | map('from_yaml') |
|
||||
map(attribute='links') | list
|
||||
}}
|
||||
- name: define list of VM mac addresses
|
||||
|
||||
- name: define list of VM mac addresses and VM boot mode
|
||||
set_fact:
|
||||
vm_nic: "{{ dict(['nat_mac', 'provision_mac'] | zip([nat_mac_list[0], item.spec.bootMACAddress])) }}"
|
||||
vm_cfg: "{{ dict(['boot_mode', 'nat_mac', 'provision_mac'] | zip([item.spec.bootMode, nat_mac_list[0], item.spec.bootMACAddress])) }}"
|
||||
vars:
|
||||
nat_mac_list: |
|
||||
{{
|
||||
@ -59,6 +63,7 @@
|
||||
loop: "{{ bmh }}"
|
||||
loop_control:
|
||||
index_var: idx
|
||||
register: vm_nic_fact
|
||||
register: vm_cfg_fact
|
||||
|
||||
- set_fact:
|
||||
"{{ name }}_vm_nics": "{{ vm_nic_fact.results | map(attribute='ansible_facts.vm_nic') | list }}"
|
||||
"{{ name }}_vm_cfg": "{{ vm_cfg_fact.results | map(attribute='ansible_facts.vm_cfg') | list }}"
|
@ -51,6 +51,7 @@
|
||||
size: "{{ chosen_flavor.ephemeral_disk_size }}"
|
||||
pool: "{{ airship_gate_names.pool }}"
|
||||
volume_action: create
|
||||
|
||||
- name: Create target volumes
|
||||
include_role:
|
||||
name: libvirt-volume
|
||||
@ -70,7 +71,7 @@
|
||||
name: libvirt-domain
|
||||
vars:
|
||||
libvirt_domain:
|
||||
boot_mode: UEFI
|
||||
boot_mode: "{{ chosen_flavor.target_vm_cfg[vm_index|int - 1].boot_mode | default('UEFI') }}"
|
||||
enable_vnc: true
|
||||
console_log_enabled: true
|
||||
state: shutdown
|
||||
@ -88,9 +89,9 @@
|
||||
pool: "{{ airship_gate_names.pool }}"
|
||||
interfaces:
|
||||
- network: "{{ airship_gate_names.nat_network }}"
|
||||
mac: "{{ chosen_flavor.target_vm_nics[vm_index|int - 1].nat_mac | default('')}}"
|
||||
mac: "{{ chosen_flavor.target_vm_cfg[vm_index|int - 1].nat_mac | default('') }}"
|
||||
- network: "{{ airship_gate_names.provision_network }}"
|
||||
mac: "{{ chosen_flavor.target_vm_nics[vm_index|int - 1].provision_mac | default('')}}"
|
||||
mac: "{{ chosen_flavor.target_vm_cfg[vm_index|int - 1].provision_mac | default('') }}"
|
||||
loop_control:
|
||||
loop_var: vm_index
|
||||
with_sequence: "start=1 end={{ chosen_flavor.target_vms_count }}"
|
||||
@ -100,7 +101,7 @@
|
||||
name: libvirt-domain
|
||||
vars:
|
||||
libvirt_domain:
|
||||
boot_mode: UEFI
|
||||
boot_mode: "{{ chosen_flavor.ephemeral_vm_cfg[0].boot_mode | default('UEFI') }}"
|
||||
enable_vnc: true
|
||||
console_log_enabled: true
|
||||
state: shutdown
|
||||
@ -114,9 +115,9 @@
|
||||
pool: "{{ airship_gate_names.pool }}"
|
||||
interfaces:
|
||||
- network: "{{ airship_gate_names.nat_network }}"
|
||||
mac: "{{ chosen_flavor.ephemeral_vm_nics[0].nat_mac | default('')}}"
|
||||
mac: "{{ chosen_flavor.ephemeral_vm_cfg[0].nat_mac | default('') }}"
|
||||
- network: "{{ airship_gate_names.provision_network }}"
|
||||
mac: "{{ chosen_flavor.ephemeral_vm_nics[0].provision_mac | default('')}}"
|
||||
mac: "{{ chosen_flavor.ephemeral_vm_cfg[0].provision_mac | default('') }}"
|
||||
|
||||
- name: Add noauth sushy-emulator to apache
|
||||
include_role:
|
||||
|
Loading…
Reference in New Issue
Block a user