Automatically select a test host from inventory file

Let Tobiko IR plugin look for default host names in inventory
when no one is given and use any of below
- undercloud-0 (standard for tripleo multinode setup)
- tempest (standard for OpenStack upstream CI)
- primary (another standard name)

When any of above is found, just use localhost as before

Change-Id: Idadcc0b80e26c6c933cd75b1b90a7cc18fda94cb
This commit is contained in:
Federico Ressi 2020-04-21 15:14:48 +02:00
parent d89913348b
commit 2c795b1d4e
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,20 @@
---
- hosts: '{{ test_host }}'
- hosts: 'localhost'
tasks:
- name: "select test host from inventory"
set_fact:
test_host: '{{ item }}'
when:
- test_host is not defined
- item in hostvars
loop:
- "undercloud-0"
- "tempest"
- "primary"
- hosts: '{{ test_host | default("localhost") }}'
gather_facts: yes
any_errors_fatal: yes
roles:

View File

@ -16,8 +16,6 @@ subparsers:
options:
host:
type: Value
required: True
default: localhost
help: Target host where test cases are deployed and executed
ansible_variable: test_host