tempest/roles/set-src-dest-host/tasks/main.yaml
Martin Kopec 450096d30a Add set-src-dest-host role
The role will find out the available hosts and set
compute.migration_source_host and compute.migration_dest_host
options in tempest.conf if tempest_set_src_dest_host is set to
True.

Change-Id: Ic01970b100a7bb30d9c78229204c7de67681108c
2024-02-24 22:35:29 +01:00

30 lines
913 B
YAML

- name: Find out hostnames
set_fact:
devstack_hostnames: "{{ devstack_hostnames|default([]) + [hostvars[zj_item]['ansible_hostname'] | default('unknown')] }}"
loop: "{{ query('inventory_hostnames', 'all,!localhost') }}"
loop_control:
loop_var: zj_item
ignore_errors: yes # noqa ignore-errors
- name: Found hostnames
debug:
msg: |
# Available hosts
{{ devstack_hostnames }}
- name: Set migration_source_host in tempest.conf
become: true
community.general.ini_file:
path: "{{ devstack_base_dir }}/tempest/etc/tempest.conf"
section: compute
option: migration_source_host
value: "{{ devstack_hostnames[0] }}"
- name: Set migration_dest_host in tempest.conf
become: true
community.general.ini_file:
path: "{{ devstack_base_dir }}/tempest/etc/tempest.conf"
section: compute
option: migration_dest_host
value: "{{ devstack_hostnames[1] }}"