|
| 1 | +--- |
| 2 | +- name: Run telemetry tests to verify metrics on osp18 |
| 3 | + hosts: "{{ cifmw_target_hook_host | default('localhost') }}" |
| 4 | + gather_facts: true |
| 5 | + environment: |
| 6 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 7 | + PATH: "{{ cifmw_path }}:/var/lib/ansible/bin" |
| 8 | + vars_files: |
| 9 | + - vars/common.yml |
| 10 | + - vars/osp18_env.yml |
| 11 | + vars: |
| 12 | + cifmw_ci_setup_oc_install_path: "{{ ansible_user_dir ~ '/bin' }}" |
| 13 | + # openshift client |
| 14 | + cifmw_ci_setup_openshift_client_download_uri: "https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp" |
| 15 | + cifmw_ci_setup_openshift_minimum_version: 4 |
| 16 | + cifmw_ci_setup_openshift_client_version: 'stable-4.16' |
| 17 | + tasks: |
| 18 | + #TODO: Add this as a common playbook so it can be added to the other tests as well. |
| 19 | + #- name: Install oc |
| 20 | + # ansible.builtin.include_role: |
| 21 | + # name: cifmw.general.ci_setup |
| 22 | + # tasks_from: packages |
| 23 | + # vars: |
| 24 | + # cifmw_ci_setup_packages: [] |
| 25 | + #TODO: use ci_setup one deps installation is sorted |
| 26 | + - name: Ensure openshift client install path is present |
| 27 | + ansible.builtin.file: |
| 28 | + path: "{{ cifmw_ci_setup_oc_install_path }}" |
| 29 | + state: directory |
| 30 | + mode: "0755" |
| 31 | + |
| 32 | + - name: Install openshift client |
| 33 | + ansible.builtin.unarchive: |
| 34 | + src: "{{ cifmw_ci_setup_openshift_client_download_uri }}/{{ cifmw_ci_setup_openshift_client_version }}/openshift-client-linux.tar.gz" |
| 35 | + dest: "{{ cifmw_ci_setup_oc_install_path }}" |
| 36 | + remote_src: true |
| 37 | + mode: "0755" |
| 38 | + creates: "{{ cifmw_ci_setup_oc_install_path }}/oc" |
| 39 | + |
| 40 | + - name: Add the OC path to cifmw_path if needed |
| 41 | + vars: |
| 42 | + _cifmw_paths_list: >- |
| 43 | + {{ |
| 44 | + cifmw_path | split(':') |
| 45 | + if cifmw_path is defined else [] |
| 46 | + }} |
| 47 | + when: cifmw_ci_setup_oc_install_path not in _cifmw_paths_list |
| 48 | + ansible.builtin.set_fact: |
| 49 | + cifmw_path: "{{ cifmw_ci_setup_oc_install_path }}:{{ ansible_env.PATH }}" |
| 50 | + cacheable: true |
| 51 | + |
| 52 | + - name: Inject oc completion in local profile |
| 53 | + block: |
| 54 | + - name: Create completion file |
| 55 | + ansible.builtin.shell: # noqa: risky-shell-pipe |
| 56 | + cmd: >- |
| 57 | + {{ cifmw_ci_setup_oc_install_path }}/oc completion bash | |
| 58 | + tee -a ~/.oc_completion |
| 59 | + creates: "{{ ansible_user_dir }}/.oc_completion" |
| 60 | + no_log: true |
| 61 | + |
| 62 | + - name: Source completion from within .bashrc |
| 63 | + ansible.builtin.blockinfile: |
| 64 | + create: true |
| 65 | + mode: "0644" |
| 66 | + path: "{{ ansible_user_dir }}/.bashrc" |
| 67 | + block: |- |
| 68 | + if [ -f ~/.oc_completion ]; then |
| 69 | + source ~/.oc_completion |
| 70 | + fi |
| 71 | +
|
| 72 | + - name: Log into openshift |
| 73 | + ansible.builtin.shell: |
| 74 | + cmd: | |
| 75 | + oc login -u {{ cifmw_openshift_user }} -p {{ cifmw_openshift_password }} --insecure-skip-tls-verify {{ cifmw_openshift_api }} |
| 76 | + register: cmd |
| 77 | + retries: 10 |
| 78 | + delay: 10 |
| 79 | + until: cmd.rc == 0 |
| 80 | + |
| 81 | + |
| 82 | +- name: Patch openstackclient to include cloudkitty client |
| 83 | + hosts: "{{ cifmw_target_hook_host | default('localhost') }}" |
| 84 | + gather_facts: true |
| 85 | + environment: |
| 86 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 87 | + PATH: "{{ cifmw_path }}" |
| 88 | + vars_files: |
| 89 | + - vars/common.yml |
| 90 | + - vars/osp18_env.yml |
| 91 | + tasks: |
| 92 | + - name: Patch cloudkittyclient into openstackclient |
| 93 | + ansible.builtin.shell: |
| 94 | + cmd: | |
| 95 | + oc exec -n openstack openstackclient -- python3 -m ensurepip --upgrade |
| 96 | + oc exec -n openstack openstackclient -- python3 -m pip install --upgrade git+https://github.com/openstack/python-cloudkittyclient@stable/2025.1 |
| 97 | +
|
| 98 | +
|
0 commit comments