--- - hosts: localhost tasks: - name: Load state from file include_vars: file: "{{ state_file_path }}" name: tenks_state - name: Perform Virtual BMC configuration hosts: libvirt vars: vbmc_nodes: >- {{ hostvars.localhost.tenks_state[inventory_hostname].nodes | default([]) | selectattr('ironic_driver', 'eq', bmc_emulators.virtualbmc) | list }} tasks: - name: Check that enough ports are available for Virtual BMC fail: msg: > {{ vbmc_nodes | count }} nodes were specified to be added to Virtual BMC, but only {{ ipmi_port_range_end - ipmi_port_range_start }} ports are available for use by Virtual BMC. when: >- (vbmc_nodes | count) > (ipmi_port_range_end - ipmi_port_range_start) - name: Register domains with Virtual BMC include_role: name: virtualbmc-domain vars: vbmc_domain: "{{ domain }}" vbmc_ipmi_address: "{{ ipmi_address }}" vbmc_ipmi_username: "{{ ipmi_username }}" vbmc_ipmi_password: "{{ ipmi_password }}" vbmc_ipmi_port: "{{ ipmi_port_range_start + port_offset }}" vbmc_virtualenv_path: "{{ virtualenv_path }}" vbmc_log_directory: "{{ log_directory }}" vbmc_state: "{{ 'absent' if cmd == 'teardown' else 'present' }}" loop: "{{ vbmc_nodes | map(attribute='name') | sort | list }}" loop_control: loop_var: domain index_var: port_offset