Set undercloud_ssh_hostname on tobiko.conf
Tobiko IR tasks failed on some downstream environments when the undercloud hostname was not undercloud-0 When this happens, the tobiko IR command can be executed with --undercloud-host or --underclout-ssh-host options RHOSENTDFG-1695 Change-Id: Ife055b62682044bdc446e6447ef9da562fe4bb73 Co-Author: Eduardo Olivares Toledo <eolivare@redhat.com>
This commit is contained in:
parent
b9868d44ca
commit
e21d209587
@ -117,6 +117,14 @@ subparsers:
|
|||||||
type: Value
|
type: Value
|
||||||
help: Test case timeout in seconds
|
help: Test case timeout in seconds
|
||||||
ansible_variable: test_case_timeout
|
ansible_variable: test_case_timeout
|
||||||
|
undercloud_host:
|
||||||
|
type: Value
|
||||||
|
help: inventory hostname of the undercloud host
|
||||||
|
ansible_variable: undercloud_hostname
|
||||||
|
undercloud_ssh_host:
|
||||||
|
type: Value
|
||||||
|
help: hostname or IP address to be used to connect to undercloud host
|
||||||
|
ansible_variable: undercloud_ssh_hostname
|
||||||
|
|
||||||
- title: Run stage
|
- title: Run stage
|
||||||
options:
|
options:
|
||||||
|
17
roles/tests/Vagrantfile
vendored
17
roles/tests/Vagrantfile
vendored
@ -27,8 +27,12 @@ UPPER_CONSTRAINTS_FILE = ENV.fetch(
|
|||||||
NODES = {
|
NODES = {
|
||||||
'primary' => {'ip' => '172.18.161.6',
|
'primary' => {'ip' => '172.18.161.6',
|
||||||
'hostname' => 'primary'},
|
'hostname' => 'primary'},
|
||||||
'secondary' => {'ip' => '172.18.161.7',
|
'secundary' => {'ip' => '172.18.161.7',
|
||||||
'hostname' => 'secondary'},
|
'hostname' => 'secundary'},
|
||||||
|
}
|
||||||
|
|
||||||
|
GROUPS = {
|
||||||
|
'undercloud' => ['secundary']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,10 +100,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
libvirt.memory = MEMORY
|
libvirt.memory = MEMORY
|
||||||
end
|
end
|
||||||
|
|
||||||
# Spawn secondary VMs
|
# Spawn secundary VMs
|
||||||
config.vm.define 'secondary' do |node|
|
config.vm.define 'secundary' do |node|
|
||||||
node.vm.hostname = NODES['secondary']['hostname']
|
node.vm.hostname = NODES['secundary']['hostname']
|
||||||
node.vm.network "private_network", ip: NODES['secondary']['ip']
|
node.vm.network "private_network", ip: NODES['secundary']['ip']
|
||||||
end
|
end
|
||||||
|
|
||||||
# Spawn primary VM and run test cases on it
|
# Spawn primary VM and run test cases on it
|
||||||
@ -113,6 +117,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|||||||
ansible.limit = "all"
|
ansible.limit = "all"
|
||||||
ansible.extra_vars = {
|
ansible.extra_vars = {
|
||||||
'vagrant_nodes' => NODES,
|
'vagrant_nodes' => NODES,
|
||||||
|
'vagrant_groups' => GROUPS,
|
||||||
'ssh_key_file' => SSH_KEY_FILE,
|
'ssh_key_file' => SSH_KEY_FILE,
|
||||||
'rh_username' => RH_USERNAME,
|
'rh_username' => RH_USERNAME,
|
||||||
'rh_password' => RH_PASSWORD,
|
'rh_password' => RH_PASSWORD,
|
||||||
|
@ -126,8 +126,10 @@
|
|||||||
set_fact:
|
set_fact:
|
||||||
test_inventory_hostvars:
|
test_inventory_hostvars:
|
||||||
'{{ test_inventory_hostvars_yaml | from_yaml }}'
|
'{{ test_inventory_hostvars_yaml | from_yaml }}'
|
||||||
|
test_inventory_groups: '{{ vagrant_groups }}'
|
||||||
|
|
||||||
- debug: var=test_inventory_hostvars
|
- debug: var=test_inventory_hostvars
|
||||||
|
- debug: var=test_inventory_groups
|
||||||
|
|
||||||
|
|
||||||
- hosts: primary
|
- hosts: primary
|
||||||
@ -138,8 +140,8 @@
|
|||||||
- name: "copy '{{ tobiko_src_dir }}' to '{{ tobiko_dir }}'"
|
- name: "copy '{{ tobiko_src_dir }}' to '{{ tobiko_dir }}'"
|
||||||
synchronize:
|
synchronize:
|
||||||
src: "{{ tobiko_src_dir | realpath }}/."
|
src: "{{ tobiko_src_dir | realpath }}/."
|
||||||
dest: "{{ tobiko_dir | realpath }}"
|
dest: "{{ tobiko_dir }}"
|
||||||
use_ssh_args: yes
|
use_ssh_args: yes
|
||||||
recursive: yes
|
recursive: yes
|
||||||
rsync_opts:
|
rsync_opts:
|
||||||
- '--exclude-from={{ tobiko_src_dir | realpath }}/.gitignore'
|
- '--exclude-from={{ tobiko_src_dir }}/.gitignore'
|
||||||
|
@ -36,10 +36,9 @@
|
|||||||
register: include_platform_vars
|
register: include_platform_vars
|
||||||
|
|
||||||
- name: "run Tox InfraRed plugin"
|
- name: "run Tox InfraRed plugin"
|
||||||
command:
|
shell:
|
||||||
cmd: >
|
cmd: >
|
||||||
'{{ tox_executable }}' -e infrared --
|
'{{ tox_executable }}' -e infrared --
|
||||||
--host secondary
|
|
||||||
--collect-dir '{{ test_collect_dir }}'
|
--collect-dir '{{ test_collect_dir }}'
|
||||||
chdir: '{{ test_dir }}'
|
chdir: '{{ test_dir }}'
|
||||||
environment:
|
environment:
|
||||||
|
@ -8,7 +8,7 @@ test_become: '{{ not (test_no_become | bool) }}'
|
|||||||
|
|
||||||
# --- Test deploy options -----------------------------------------------------
|
# --- Test deploy options -----------------------------------------------------
|
||||||
|
|
||||||
test_deploy_home: '{{ ansible_user_dir | realpath }}/src'
|
test_deploy_home: '{{ ansible_user_dir }}/src'
|
||||||
|
|
||||||
git_base: 'https://opendev.org'
|
git_base: 'https://opendev.org'
|
||||||
|
|
||||||
|
@ -9,9 +9,16 @@ test_default_conf:
|
|||||||
testcase:
|
testcase:
|
||||||
timeout: "{{ test_case_timeout }}"
|
timeout: "{{ test_case_timeout }}"
|
||||||
|
|
||||||
|
tripleo:
|
||||||
|
undercloud_ssh_hostname: "{{ undercloud_ssh_hostname }}"
|
||||||
|
|
||||||
test_log_debug: false
|
test_log_debug: false
|
||||||
|
|
||||||
test_case_timeout: 7200.
|
test_case_timeout: 7200.
|
||||||
|
|
||||||
# OpenStack client credentials
|
# OpenStack client credentials
|
||||||
stackrc_file: '{{ ansible_user_dir }}/overcloudrc'
|
stackrc_file: '{{ ansible_user_dir }}/overcloudrc'
|
||||||
|
|
||||||
|
undercloud_hostname: '{{ groups.get("undercloud", []) | first | default("undercloud-0") }}'
|
||||||
|
|
||||||
|
undercloud_ssh_hostname: ''
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
- name: "pick undercloud SSH shotname from inventory"
|
||||||
|
set_fact:
|
||||||
|
undercloud_ssh_hostname: >-
|
||||||
|
{{ hostvars[undercloud_hostname].ansible_hostname |
|
||||||
|
default(undercloud_hostname) }}
|
||||||
|
when:
|
||||||
|
- (undercloud_ssh_hostname | length) == 0
|
||||||
|
- (undercloud_hostname | length) > 0
|
||||||
|
- undercloud_hostname in hostvars
|
||||||
|
|
||||||
|
|
||||||
- name: "list configuration options"
|
- name: "list configuration options"
|
||||||
set_fact:
|
set_fact:
|
||||||
test_conf_yaml: |
|
test_conf_yaml: |
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
test_inventory_user: '{{ ansible_user }}'
|
test_inventory_user: '{{ ansible_user }}'
|
||||||
test_inventory_hostvars: {}
|
test_inventory_hostvars: {}
|
||||||
test_inventory_file: '{{ test_dir | realpath }}/ansible_hosts'
|
test_inventory_groups: {}
|
||||||
|
test_inventory_file: '{{ test_dir }}/ansible_hosts'
|
||||||
|
@ -45,15 +45,15 @@
|
|||||||
- hostvars[hostname][varname] is defined
|
- hostvars[hostname][varname] is defined
|
||||||
- test_inventory_hostvars[hostname][varname] is not defined
|
- test_inventory_hostvars[hostname][varname] is not defined
|
||||||
|
|
||||||
|
- debug: var=test_inventory_file
|
||||||
- debug: var=test_inventory_hostvars
|
|
||||||
|
|
||||||
|
|
||||||
- name: "ensures inventory directory exists"
|
- name: "ensures inventory directory exists"
|
||||||
file:
|
file:
|
||||||
path: '{{ test_inventory_file | dirname }}'
|
path: '{{ test_inventory_file | dirname }}'
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
|
- debug: var=test_inventory_hostvars
|
||||||
|
- debug: var=test_inventory_groups
|
||||||
|
|
||||||
- name: "writes inventory file to: '{{ test_inventory_file }}'"
|
- name: "writes inventory file to: '{{ test_inventory_file }}'"
|
||||||
template:
|
template:
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
[all]
|
[all]
|
||||||
{% for name, vars in (test_inventory_hostvars | dictsort) %}
|
{% for host, vars in (test_inventory_hostvars | dictsort) %}
|
||||||
{{ name }} ansible_host={{ vars.ansible_host }}
|
{{ host }} ansible_host={{ vars.ansible_host }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
[all:vars]
|
[all:vars]
|
||||||
ansible_python_interpreter = {{ test_inventory_python_interpreter }}
|
ansible_python_interpreter = {{ test_inventory_python_interpreter }}
|
||||||
ansible_user = {{ test_inventory_user }}
|
ansible_user = {{ test_inventory_user }}
|
||||||
|
|
||||||
|
{% for group, hosts in (test_inventory_groups | dictsort) %}
|
||||||
|
[{{ group }}]
|
||||||
|
{% for host in hosts %}
|
||||||
|
{{ host }}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user