Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hypervisor param to shiftstack playbook execution #2596

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions roles/libvirt_manager/templates/all-inventory.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ virtual machines.
ansible_ssh_common_args: "-o StrictHostKeyChecking=no -J {{ ansible_user | default(ansible_user_id) }}@{{ _hostname }}"
{% endif %}
{% endfor %}
hypervisors:
hosts:
{% set _hypervisors = (
( _cifmw_libvirt_manager_layout.vms.values() | selectattr('target', 'defined') | map(attribute='target') | list)
+ [inventory_hostname] ) | unique %}
{% for _hypervisor in _hypervisors %}
{{ _hypervisor }}:
{% set _hostname = hostvars[_hypervisor]['ansible_host'] | default(_hypervisor[_target]['inventory_hostname']) %}
ansible_host: "{{ _hostname }}"
ansible_ssh_private_key_file: "~/.ssh/ssh_{{ _hostname }}"
vars:
{% endfor %}
localhosts:
hosts:
localhost:
Expand Down
1 change: 1 addition & 0 deletions roles/libvirt_manager/templates/inventory.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
{% else %}
ansible_ssh_private_key_file: ~/.ssh/id_cifw
{% endif %}
cifmw_hypervisor_host: "{{ _cifmw_libvirt_manager_layout.vms[host.key].target | default(inventory_hostname) }}"
{% endfor %}
1 change: 1 addition & 0 deletions roles/reproducer/tasks/configure_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
marker: "## {mark} {{ _ssh_host }}"
block: |-
Host {{ _ssh_host }} {{ hostvars[host]['inventory_hostname'] }}
Hostname {{ _ssh_host }}
IdentityFile ~/.ssh/ssh_{{ _ssh_host }}
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
Expand Down
1 change: 1 addition & 0 deletions roles/shiftstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Role for triggering Openshift on Openstack QA automation (installation and tests
* `cifmw_shiftstack_client_pod_image`: (*string*) The image for the container running in the `cifmw_shiftstack_client_pod_name` pod. Defaults to `quay.io/shiftstack-qe/shiftstack-client:latest`.
* `cifmw_shiftstack_client_pvc_manifest`: (*string*) The file name for the shiftstackclient pvc manifest. Defaults to `"{{ cifmw_shiftstack_client_pod_name }}_pvc.yml"`.
* `cifmw_shiftstack_cluster_name`: (*string*) The Openshift cluster name. Defaults to `ostest`.
* `cifmw_shiftstack_hypervisor`: (*string*) The hypervisor where RHOSO is deployed. Defaults to `hostvars[hostvars['controller-0']['cifmw_hypervisor_host']]['ansible_host']`.
* `cifmw_shiftstack_exclude_artifacts_regex`: (*string*) Regex that will be passed on `oc rsync` command as `--exclude` param, so the role does not gather the artifacts matching it.
* `cifmw_shiftstack_installation_dir`: (*string*) Directory to place installation files. Defaults to `"{{ cifmw_shiftstack_shiftstackclient_artifacts_dir }}/installation"`.
* `cifmw_shiftstack_manifests_dir`: (*string*) Directory name for the role generated Openshift manifests. Defaults to `"{{ cifmw_shiftstack_basedir }}/manifests"`.
Expand Down
1 change: 1 addition & 0 deletions roles/shiftstack/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ cifmw_shiftstack_client_pod_namespace: "openstack"
cifmw_shiftstack_client_pvc_manifest: "{{ cifmw_shiftstack_client_pod_name }}_pvc.yml"
cifmw_shiftstack_cluster_name: "ostest"
cifmw_shiftstack_exclude_artifacts_regex: "openshift-install"
cifmw_shiftstack_hypervisor: "hostvars[hostvars['controller-0']['cifmw_hypervisor_host']]['ansible_host']"
cifmw_shiftstack_installation_dir: "{{ cifmw_shiftstack_basedir }}/installation"
cifmw_shiftstack_manifests_dir: "{{ cifmw_shiftstack_basedir }}/manifests"
cifmw_shiftstack_project_name: "shiftstack"
Expand Down
6 changes: 5 additions & 1 deletion roles/shiftstack/tasks/test_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
command: >-
source .bashrc &&
cd shiftstack-qa &&
ansible-navigator run playbooks/{{ cifmw_shiftstack_run_playbook }} -e @jobs_definitions/{{ testconfig }} -e ocp_cluster_name={{ cifmw_shiftstack_cluster_name }} -e user_cloud={{ cifmw_shiftstack_project_name }}
ansible-navigator run playbooks/{{ cifmw_shiftstack_run_playbook }}
-e @jobs_definitions/{{ testconfig }}
-e ocp_cluster_name={{ cifmw_shiftstack_cluster_name }}
-e user_cloud={{ cifmw_shiftstack_project_name }}
-e hypervisor={{ cifmw_shiftstack_hypervisor }}
ansible.builtin.include_tasks: exec_command_in_pod.yml

rescue:
Expand Down
Loading