- name: pre-launch test VM instance no_log: "{{ use_no_log }}" when: - prelaunch_test_instance|bool - "'pre_launch.bash' in prelaunch_test_instance_scripts" vars: cinder_volume_backend_configured: "{{ cinder_volume_backend in supported_volume_backends }}" cinder_backup_backend_configured: "{{ cinder_backup_backend in supported_backup_backends }}" ansible.builtin.shell: cmd: | {{ shell_header }} export OPENSTACK_COMMAND="{{ openstack_command }}" export PING_COMMAND="{{ ping_command }}" export EDPM_CONFIGURE_HUGEPAGES={{ use_hugepages | default(false) | string | lower }} export CINDER_VOLUME_BACKEND_CONFIGURED={{ cinder_volume_backend_configured | string | lower }} export CINDER_BACKUP_BACKEND_CONFIGURED={{ cinder_backup_backend_configured | string | lower }} export PING_TEST_VM={{ ping_test | string | lower }} {{ lookup('ansible.builtin.template', 'pre_launch.bash.j2') }} - name: pre-launch test Ironic instance no_log: "{{ use_no_log }}" when: - prelaunch_test_instance|bool - "'pre_launch_ironic.bash' in prelaunch_test_instance_scripts" ansible.builtin.shell: cmd: | {{ shell_header }} export OPENSTACK_COMMAND="{{ openstack_command }}" export ENROLL_BMAAS_IRONIC_NODES={{ enroll_ironic_bmaas_nodes | string | lower }} export PRE_LAUNCH_IRONIC_RESTART_CHRONY={{ pre_launch_ironic_restart_chrony | string | lower }} export PRE_LAUNCH_IRONIC_MANAGE_NODES={{ pre_launch_ironic_manage_nodes | string | lower }} export PRE_LAUNCH_IRONIC_INSPECT_NODES={{ pre_launch_ironic_inspect_nodes | string | lower }} export PRE_LAUNCH_IRONIC_PROVIDE_NODES={{ pre_launch_ironic_provide_nodes | string | lower }} export PRE_LAUNCH_IRONIC_CREATE_INSTANCE={{ pre_launch_ironic_create_instance | string | lower }} {{ lookup('ansible.builtin.file', 'pre_launch_ironic.bash') }} - name: Start and setup ping test when: - prelaunch_test_instance|bool - "'pre_launch.bash' in prelaunch_test_instance_scripts" - ping_test|bool block: - name: Start the ping test to the VM instance. vars: fip: "{{ public_subnet_fip_2 }}" ansible.builtin.shell: cmd: | ping -D {{ fip }} &> {{ ping_test_log_file }} & - name: Create stop l3 agent connectivity check scripts. ansible.builtin.template: src: "stop_ping.sh.j2" dest: "{{ stop_ping_script }}" mode: "0775" - name: Remember that the ping test is running. ansible.builtin.set_fact: stop_ping_script: "{{ stop_ping_script }}" # We need to remember those two when the role's default values # are used, ie not set from loaded variable file. prelaunch_test_instance: "{{ prelaunch_test_instance }}" ping_test: "{{ ping_test }}" - name: creates Barbican secret no_log: "{{ use_no_log }}" when: prelaunch_barbican_secret|default(false) ansible.builtin.shell: cmd: | {{ shell_header }} {{ openstack_command }} secret store --name testSecret --payload 'TestPayload' - name: Issue session fernet token no_log: "{{ use_no_log }}" ansible.builtin.shell: cmd: | {{ shell_header }} {{ openstack_command }} token issue -f value -c id register: before_adoption_token - name: Render OIDC cloudrc when: enable_federation | default(false) | bool ansible.builtin.template: src: "{{ federation_oidc_cloudrc_template | default('tests/roles/development_environment/templates/kctestuser1.j2') }}" dest: "/tmp/{{ federation_oidc_cloudrc_filename }}" mode: "0600" - name: Upload OIDC cloudrc to source cloud when: enable_federation | default(false) | bool ansible.builtin.shell: cmd: | {{ shell_header }} scp -o StrictHostKeyChecking=no -i {{ edpm_privatekey_path }} /tmp/{{ federation_oidc_cloudrc_filename }} {{ source_osp_ssh_user }}@{{ standalone_ip | default(edpm_node_ip) }}:{{ federation_oidc_cloudrc_remote_path }} - name: Issue OIDC token no_log: "{{ use_no_log }}" when: - enable_federation | default(false) | bool ansible.builtin.shell: cmd: | {{ shell_header }} {{ get_oidc_token_command }} register: before_adoption_oidc_token - name: Create credential for sanity checking its value after adoption no_log: "{{ use_no_log }}" ansible.builtin.shell: cmd: | {{ shell_header }} {{ openstack_command }} credential create admin test -f value -c id register: before_adoption_credential - name: create resources script when: neutron_qe_test | default('false') | bool environment: OS_CLOUD_IP: "{{ standalone_ip | default(edpm_node_ip) }}" block: - name: execute create resources script ansible.builtin.shell: | ssh ${OS_CLOUD_IP} "set -o pipefail && chmod 744 {{ neutron_qe_dir }}/create_resources.sh && \ {{ neutron_qe_dir }}/create_resources.sh > {{ neutron_qe_dir }}/create_resources.sh.log 2>&1" - name: execute prepare-pinger script ansible.builtin.shell: | ssh ${OS_CLOUD_IP} "set -o pipefail && chmod 744 {{ neutron_qe_dir }}/prepare-pinger.sh && \ {{ neutron_qe_dir }}/prepare-pinger.sh > {{ neutron_qe_dir }}/prepare-pinger.sh.log 2>&1" - name: execute start-pinger script ansible.builtin.shell: | timeout 20 ssh ${OS_CLOUD_IP} "set -o pipefail && chmod 744 {{ neutron_qe_dir }}/start-pinger.sh && \ nohup {{ neutron_qe_dir }}/start-pinger.sh > {{ neutron_qe_dir }}/start-pinger.sh.log 2>&1" & - name: tobiko validate pings, create workloads when: tobiko_qe_test | default('false') | bool environment: OS_CLOUD_IP: "{{ standalone_ip | default(edpm_node_ip) }}" EDPM_PRIVATEKEY_PATH: "{{ edpm_privatekey_path }}" block: # Temporal - tobiko installation task - name: tobiko installation ansible.builtin.shell: > ssh -i ${EDPM_PRIVATEKEY_PATH} -o StrictHostKeyChecking=no ${OS_CLOUD_IP} "set -o pipefail && mkdir -p ~/src/x && cd ~/src/x && git clone https://github.com/redhat-openstack/tobiko.git && cd tobiko && git checkout {{ tobiko_version }}" - name: oc undercloud installation ansible.builtin.shell: > ssh -i ${EDPM_PRIVATEKEY_PATH} -o StrictHostKeyChecking=no ${OS_CLOUD_IP} "curl -s -L https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/stable/openshift-client-linux.tar.gz | sudo tar -zxvf - -C /usr/local/bin/" - name: copy kube conf to undercloud ansible.builtin.shell: | {% if ipv6_enabled %} scp -i ${EDPM_PRIVATEKEY_PATH} -o StrictHostKeyChecking=no -r ~/.kube/ [${OS_CLOUD_IP}]:~ {% else %} scp -i ${EDPM_PRIVATEKEY_PATH} -o StrictHostKeyChecking=no -r ~/.kube/ ${OS_CLOUD_IP}:~ {% endif %} - name: upload tobiko-playbook.yaml to the undercloud delegate_to: "{{ standalone_ip | default(edpm_node_ip) }}" vars: ansible_ssh_private_key_file: "{{ edpm_privatekey_path }}" tobiko_playbook: | - name: Playbook to run tobiko from the undercloud pre-adoption hosts: localhost tasks: - name: "run tests" ansible.builtin.include_role: name: tobiko-run ansible.builtin.copy: mode: a+r content: "{{ tobiko_playbook }}" dest: ~/src/x/tobiko/tobiko-playbook.yaml - name: Add tobiko.conf to the undercloud vars: ansible_ssh_private_key_file: "{{ edpm_privatekey_path }}" delegate_to: "{{ standalone_ip | default(edpm_node_ip) }}" ansible.builtin.copy: mode: a+r content: "{{ tobiko_conf_file }}" dest: ~/src/x/tobiko/tobiko.conf - name: Run Tobiko from the undercloud vars: ansible_ssh_private_key_file: "{{ edpm_privatekey_path }}" delegate_to: "{{ standalone_ip | default(edpm_node_ip) }}" ansible.builtin.shell: chdir: ~/src/x/tobiko/ cmd: > ansible-playbook tobiko-playbook.yaml -e test_workflow={{ tobiko_test_workflow }} {% if tobiko_pytest_addopts -%} -e pytest_addopts_global="{{ tobiko_pytest_addopts }}" {% endif -%} - name: copy keys from undercloud for tobiko ansible.builtin.shell: | {% if ipv6_enabled %} mkdir -p ~/ci-framework-data/tests/test_operator; scp -i ${EDPM_PRIVATEKEY_PATH} -o StrictHostKeyChecking=no -r [${OS_CLOUD_IP}]:~/.ssh/id_ecdsa* ~/ci-framework-data/tests/test_operator/ {% else %} mkdir -p ~/ci-framework-data/tests/test_operator; scp -i ${EDPM_PRIVATEKEY_PATH} -o StrictHostKeyChecking=no -r ${OS_CLOUD_IP}:~/.ssh/id_ecdsa* ~/ci-framework-data/tests/test_operator/ {% endif %} - name: create Octavia load balancer no_log: "{{ use_no_log }}" when: - prelaunch_octavia_workload|bool - prelaunch_test_instance|bool - "'pre_launch.bash' in prelaunch_test_instance_scripts" ansible.builtin.shell: cmd: | {{ shell_header }} {{ openstack_command }} loadbalancer create --vip-subnet-id public_subnet --name lb1 --wait {{ openstack_command }} loadbalancer listener create --protocol http --protocol-port 80 --name listener1 lb1 --wait - name: get the load balancer VIP address no_log: "{{ use_no_log }}" when: - prelaunch_octavia_workload|bool - prelaunch_test_instance|bool - "'pre_launch.bash' in prelaunch_test_instance_scripts" ansible.builtin.shell: cmd: | {{ shell_header }} {{ openstack_command }} loadbalancer show -f value -c vip_address lb1 register: octavia_vip_address - name: test the load balancer VIP address no_log: "{{ use_no_log }}" when: - prelaunch_octavia_workload|bool - prelaunch_test_instance|bool - "'pre_launch.bash' in prelaunch_test_instance_scripts" ansible.builtin.shell: cmd: | {{ shell_header }} curl {{ octavia_vip_address.stdout }}