Skip to content

Commit 96f4414

Browse files
imatza-rhrlobillo
authored andcommitted
Set the installation dir inside the artifacts dir
Change the installation dir path from the home dir to the artifacts dir: artifacts/ ├── must-gather-verification ├── installation │   └── shiftstack # `user_cloud_installation_dir` │   ├── install-config.yaml │   ├── openstack # `osp_config_dir` │   │   ├── clouds.yaml │   │   └── shiftstackrc │   └── ostest # `ocp_installation_dir` This way we can more easily synchronize the installation files from the installer host to the Ansible Controller Node machine. As a result of this change, we don't need the fetch_to_inventory task anymore. Change-Id: I8a19afff1effb3f902671f69e15be963a5e823a2 Reviewed-on: https://review.gerrithub.io/c/shiftstack/shiftstack-qa/+/1196079 Reviewed-by: Yaakov Khodorkovski <[email protected]> Tested-by: Itay Matza <[email protected]> Tested-by: Yaakov Khodorkovski <[email protected]> Tested-by: rhosqeauto <[email protected]> Reviewed-by: Ramón Lobillo <[email protected]>
1 parent f901d7e commit 96f4414

File tree

21 files changed

+69
-71
lines changed

21 files changed

+69
-71
lines changed

Diff for: collection/stages/roles/conformance_test/tasks/run_conformance_test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@
109109
name: tools_must-gather
110110
vars:
111111
must_gather_dir_suffix: "must-gather-conformance"
112-
fetch_to_inventory: true

Diff for: collection/stages/roles/csi_tests/tasks/run_csi_test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@
3838
name: tools_must-gather
3939
vars:
4040
must_gather_dir_suffix: "must-gather-{{ csi_test_name }}"
41-
fetch_to_inventory: true

Diff for: collection/stages/roles/install/tasks/generate_ocp_install-config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- name: Generate install-config.yaml from template
1515
ansible.builtin.template:
1616
src: install-config.yaml.j2
17-
dest: "{{ home_dir }}/install-config.yaml"
17+
dest: "{{ user_cloud_installation_dir }}/install-config.yaml"
1818
mode: u=rw,g=rw,o=r
1919
vars:
2020
installcfg_cluster_name: "{{ ocp_cluster_name }}"
@@ -32,7 +32,7 @@
3232

3333
- name: Copy the install-config.yaml to installation dir
3434
ansible.builtin.copy:
35-
src: "{{ home_dir }}/install-config.yaml"
36-
dest: "{{ installation_dir }}/install-config.yaml"
35+
src: "{{ user_cloud_installation_dir }}/install-config.yaml"
36+
dest: "{{ ocp_installation_dir }}/install-config.yaml"
3737
remote_src: yes
3838
mode: u=rwx,g=rwx,o=rwx

Diff for: collection/stages/roles/install/tasks/ipi_tenant.yml

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
block:
44
- name: Install Openshift
55
ansible.builtin.shell: |
6-
openshift-install create cluster --log-level debug --dir {{ installation_dir }}
6+
openshift-install create cluster --log-level debug --dir {{ ocp_installation_dir }}
77
environment:
88
OS_CLOUD: "{{ user_cloud }}"
99
changed_when: true
1010
rescue:
1111
- name: Use an openshift-install flag to wait until the cluster is ready
1212
ansible.builtin.shell: |
13-
openshift-install wait-for install-complete --log-level debug --dir {{ installation_dir }}
13+
openshift-install wait-for install-complete --log-level debug --dir {{ ocp_installation_dir }}
1414
environment:
1515
OS_CLOUD: "{{ user_cloud }}"
1616
changed_when: true
1717

1818
- name: Remove the bootstrap resources after the OCP installation succeeded
1919
ansible.builtin.shell: |
20-
openshift-install destroy bootstrap --log-level debug --dir {{ installation_dir }}
20+
openshift-install destroy bootstrap --log-level debug --dir {{ ocp_installation_dir }}
2121
environment:
2222
OS_CLOUD: "{{ user_cloud }}"
2323
changed_when: true
@@ -31,12 +31,11 @@
3131
The openshift installation passed but unexpectedly needed the wait-for flag.
3232
More info in Jira KURYRQE-1002.
3333
always:
34-
- name: "Copy installation files to {{ artifacts_dir }}"
35-
ansible.builtin.copy:
36-
src: "{{ item.src }}"
37-
dest: "{{ artifacts_dir }}/{{ user_cloud }}/{{ ocp_cluster_name }}"
38-
mode: "{{ item.mode }}"
39-
loop:
40-
- {src: "{{ installation_dir }}/", mode: "0755"}
41-
- {src: "{{ osp_config_dir }}", mode: "0755"}
42-
- {src: "{{ home_dir }}/install-config.yaml", mode: "0644"}
34+
- name: Synchronize artifacts from the Ansible Managed Node to Ansible Controller
35+
ansible.posix.synchronize:
36+
src: "{{ artifacts_dir }}"
37+
dest: "{{ controller_home_dir }}"
38+
mode: pull
39+
recursive: yes
40+
times: false
41+
perms: false

Diff for: collection/stages/roles/install/tasks/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
- name: Remove the directory for the installation files (if exists)
33
ansible.builtin.file:
4-
path: "{{ installation_dir }}"
4+
path: "{{ ocp_installation_dir }}"
55
state: absent
66

77
- name: Create a directory for the installation files
88
ansible.builtin.file:
9-
path: "{{ installation_dir }}"
9+
path: "{{ ocp_installation_dir }}"
1010
state: directory
1111
mode: u=rwx,g=rw,o=r
1212

Diff for: collection/stages/roles/install/tasks/upi/bootstrap.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
- name: Run the script that modifies the bootstrap ignition file
4646
ansible.builtin.script:
4747
cmd: "scripts/upi_bootstrap.py"
48-
chdir: "{{ installation_dir }}"
48+
chdir: "{{ ocp_installation_dir }}"
4949
executable: python3
5050
environment: "{{ env_vars }}"
5151

@@ -62,7 +62,7 @@
6262
container_format: bare
6363
disk_format: raw
6464
state: present
65-
filename: "{{ installation_dir }}/bootstrap.ign"
65+
filename: "{{ ocp_installation_dir }}/bootstrap.ign"
6666

6767
- name: Retrieve the image file string
6868
block:
@@ -123,5 +123,5 @@
123123
- name: Generate the secondary ignition config file
124124
ansible.builtin.template:
125125
src: "upi_bootstrap-ignition.json.j2"
126-
dest: "{{ installation_dir }}/{{ ocp_infra_id }}-bootstrap-ignition.json"
126+
dest: "{{ ocp_installation_dir }}/{{ ocp_infra_id }}-bootstrap-ignition.json"
127127
mode: u=rw,g=rw,o=r

Diff for: collection/stages/roles/install/tasks/upi/control_plane.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
ansible.builtin.shell: "{{ script }}" # noqa: command-instead-of-shell
1717
changed_when: true
1818
args:
19-
chdir: "{{ installation_dir }}"
19+
chdir: "{{ ocp_installation_dir }}"

Diff for: collection/stages/roles/install/tasks/upi/create_ocp_manifests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
- name: Generate the Kubernetes manifests for the cluster
33
ansible.builtin.shell: |
4-
openshift-install create manifests --dir={{ installation_dir }}
4+
openshift-install create manifests --dir={{ ocp_installation_dir }}
55
changed_when: true
66

77
- name: Remove the Kubernetes manifest files that define the control plane machines and compute machineSets
88
block:
99
- name: Find the Kubernetes manifest files that define the control plane machines and compute machineSets
1010
ansible.builtin.find:
11-
paths: "{{ installation_dir }}/openshift"
11+
paths: "{{ ocp_installation_dir }}/openshift"
1212
patterns:
1313
- "99_openshift-cluster-api_master-machines-*.yaml"
1414
- "99_openshift-cluster-api_worker-machineset-*.yaml"
@@ -23,7 +23,7 @@
2323

2424
- name: Modify the Kubernetes manifest file to prevent Pods from being scheduled on the control plane machines
2525
ansible.builtin.replace:
26-
path: "{{ installation_dir }}/manifests/cluster-scheduler-02-config.yml"
26+
path: "{{ ocp_installation_dir }}/manifests/cluster-scheduler-02-config.yml"
2727
regexp: '^ mastersSchedulable: .*'
2828
replace: ' mastersSchedulable: false'
2929
after: 'spec'

Diff for: collection/stages/roles/install/tasks/upi/deploy_cluster.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
- name: Wait until the bootstrap is completed
3939
ansible.builtin.shell: |
40-
openshift-install wait-for bootstrap-complete --log-level=debug --dir {{ installation_dir }}
40+
openshift-install wait-for bootstrap-complete --log-level=debug --dir {{ ocp_installation_dir }}
4141
changed_when: false
4242

4343
- name: Remove the bootstrap resources (down-bootstrap.yaml)
@@ -110,5 +110,5 @@
110110

111111
- name: Wait until the installation is completed
112112
ansible.builtin.shell: |
113-
openshift-install wait-for install-complete --log-level=debug --dir {{ installation_dir }}
113+
openshift-install wait-for install-complete --log-level=debug --dir {{ ocp_installation_dir }}
114114
changed_when: false

Diff for: collection/stages/roles/install/tasks/upi/ignition_configs.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
- name: Create the ignition config files
33
ansible.builtin.shell: |
4-
openshift-install create ignition-configs --dir={{ installation_dir }}
4+
openshift-install create ignition-configs --dir={{ ocp_installation_dir }}
55
changed_when: true
66

77
- name: Get the OCP cluster id
88
ansible.builtin.shell:
99
cmd: jq -r .infraID metadata.json
10-
chdir: "{{ installation_dir }}"
10+
chdir: "{{ ocp_installation_dir }}"
1111
changed_when: false # noqa: command-instead-of-shell
1212
register: jq_result
1313

Diff for: collection/stages/roles/lb_tests/tasks/change_cloud_cm.yml

-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@
210210
name: tools_must-gather
211211
vars:
212212
must_gather_dir_suffix: "must-gather-change-cloud-cm"
213-
fetch_to_inventory: true
214213

215214
- name: Fail inside rescue block
216215
ansible.builtin.fail:

Diff for: collection/stages/roles/openstack_test/tasks/run_openstack_test.yml

-1
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,3 @@
9595
name: tools_must-gather
9696
vars:
9797
must_gather_dir_suffix: "must-gather-openstack-tests"
98-
fetch_to_inventory: true

Diff for: collection/stages/roles/prepare/defaults/main.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
---
2-
clouds_yaml_file_path: "{{ home_dir }}/.config/openstack/clouds.yaml"
3-
secure_yaml_file_path: "{{ home_dir }}/.config/openstack/secure.yaml"
42
project:
53
name: "{{ user_cloud }}"
64
user: user

Diff for: collection/stages/roles/prepare/tasks/clouds.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
- name: Generate RC file for {{ user_cloud }}
4343
ansible.builtin.template:
4444
src: user_env_file.j2
45-
dest: "{{ osp_config_dir }}/{{ user_cloud }}rc"
45+
dest: "{{ user_env_file }}"
4646
mode: u=rw,g=rw,o=r
4747

4848
- name: "Copy clouds.yaml to {{ osp_config_dir }}"

Diff for: collection/stages/roles/verification/tasks/main.yml

-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@
163163
ansible.builtin.include_role:
164164
name: tools_must-gather
165165
vars:
166-
fetch_to_inventory: true
167166
must_gather_dir_suffix: "must-gather-verification"
168167

169168
- name: Fail the playbook in a case of a cluster verification test failure

Diff for: collection/tools/roles/tools_cluster_checks/tasks/print_cluster_status.yml

+4-10
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,17 @@
6262
block:
6363
- name: Gather bootstrap logs
6464
ansible.builtin.shell: |
65-
openshift-install gather bootstrap --dir {{ installation_dir }} --log-level=debug
65+
openshift-install gather bootstrap --dir {{ ocp_installation_dir }} --log-level=debug
6666
environment:
6767
SSH_AUTH_SOCK: ""
6868
failed_when: false
6969
changed_when: true
7070

71-
- name: Compress {{ installation_dir }} directory
71+
- name: Compress {{ ocp_installation_dir }} directory
7272
community.general.archive:
73-
path: "{{ installation_dir }}"
74-
dest: "{{ installation_dir }}.tar.gz"
75-
mode: u=rw,g=rw,o=r
76-
77-
- name: Fetch {{ installation_dir }}.tar.gz to {{ artifacts_dir }}
78-
ansible.builtin.fetch:
79-
src: "{{ installation_dir }}.tar.gz"
73+
path: "{{ ocp_installation_dir }}"
8074
dest: "{{ artifacts_dir }}/failing_installation_logs.tar.gz"
81-
flat: yes
75+
mode: u=rw,g=rw,o=r
8276

8377
- name: Get ocp cluster version
8478
ansible.builtin.command: oc get clusterversion

Diff for: collection/tools/roles/tools_installer_host/defaults/main.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ osp_rhel_matrix:
88
installer_image: "{{ osp_rhel_matrix[openstack_version] }}"
99

1010
files_to_copy:
11-
- "{{ user_env_file | basename }}"
12-
- "clouds.yaml"
11+
- "{{ user_env_file }}"
12+
- "{{ osp_config_dir }}/clouds.yaml"
13+
14+
installer_vm_home_dir: "/home/{{ installer_vm_ssh_user }}"
15+
installer_vm_artifacts_dir: "{{ installer_vm_home_dir }}/artifacts"
16+
installer_vm_installation_dir: "{{ installer_vm_artifacts_dir }}/installation"
17+
installer_vm_user_cloud_installation_dir: "{{ installer_vm_installation_dir }}/{{ user_cloud }}"
18+
installer_vm_osp_config_dir: "{{ installer_vm_user_cloud_installation_dir }}/openstack"
1319

1420
installer_required_packages:
1521
- 'python3-openstackclient'

Diff for: collection/tools/roles/tools_installer_host/tasks/configuration_copy_workspace.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
- name: Copy files from the OSP config directory to the installer host VM
33
ansible.builtin.copy:
4-
src: "{{ osp_config_dir }}/{{ item }}"
5-
dest: "~/{{ item }}"
4+
src: "{{ item }}"
5+
dest: "{{ installer_vm_osp_config_dir }}/"
66
mode: u=rw,g=rw,o=r
77
loop: "{{ files_to_copy }}"
88

@@ -18,7 +18,7 @@
1818
- name: Copy the secure.yaml file from the OSP config directory to the installer host VM
1919
ansible.builtin.copy:
2020
src: "{{ osp_config_dir }}/secure.yaml"
21-
dest: "~/secure.yaml"
21+
dest: "{{ installer_vm_osp_config_dir }}/secure.yaml"
2222
mode: u=rw,g=rw,o=r
2323
when: not (legacy_installation | default(False))
2424

@@ -32,14 +32,14 @@
3232

3333
- name: Create a symlink to ~/clouds.yaml in ~/.config/openstack/clouds.yaml
3434
ansible.builtin.file:
35-
src: ~/clouds.yaml
35+
src: "{{ installer_vm_osp_config_dir }}/clouds.yaml"
3636
dest: ~/.config/openstack/clouds.yaml
3737
force: true
3838
state: link
3939

4040
- name: Create a symlink to ~/secure.yaml in ~/.config/openstack/secure.yaml
4141
ansible.builtin.file:
42-
src: ~/secure.yaml
42+
src: "{{ installer_vm_osp_config_dir }}/secure.yaml"
4343
dest: ~/.config/openstack/secure.yaml
4444
force: true
4545
state: link
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
# defaults file for tools_must-gather
3-
must_gather_dir_base: "{{ home_dir }}"
4-
fetch_to_inventory: false # must be defined when calling the role
3+
must_gather_dir_base: "{{ artifacts_dir }}"
54
must_gather_dir_suffix: None # must be defined when calling the role
65
must_gather_dir: "{{ must_gather_dir_base }}/{{ must_gather_dir_suffix }}"

Diff for: collection/tools/roles/tools_must-gather/tasks/main.yml

-8
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,3 @@
5454
dest: "{{ must_gather_dir_base }}/{{ must_gather_dir_suffix }}.tar.gz"
5555
mode: u=rw,g=rw,o=r
5656
no_log: true
57-
58-
- name: Fetch {{ must_gather_dir_base }}/{{ must_gather_dir_suffix }}.tar.gz to {{ artifacts_dir }}
59-
ansible.builtin.fetch:
60-
src: "{{ must_gather_dir_base }}/{{ must_gather_dir_suffix }}.tar.gz"
61-
dest: "{{ artifacts_dir }}/{{ must_gather_dir_suffix }}.tar.gz"
62-
flat: yes
63-
no_log: true
64-
when: fetch_to_inventory

Diff for: configs/global.yml

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
---
22
# Sets the Ansible Target (a.k.a Managed Node) HOME environment variable to its actual value
33
# This ensures scripts and applications running on the target machine know the user's home directory
4+
# artifacts/
5+
# ├── installation
6+
# │   └── shiftstack # Dedicated dir for OSP user_cloud - `user_cloud_installation_dir`
7+
# │   ├── install-config.yaml
8+
# │   ├── openstack # OSP config dir - `osp_config_dir`
9+
# │   │   ├── clouds.yaml
10+
# │   │   └── shiftstackrc
11+
# │   └── ostest # OCP cluster installation dir - `ocp_installation_dir`
12+
#
13+
# Note: The ci-framework job overwriting the 'user_cloud' and 'ocp_cluster_name'.
14+
# Reference: https://github.com/openstack-k8s-operators/ci-framework/pull/1882
415
home_dir: "{{ ansible_facts.env['HOME'] }}"
516
artifacts_dir: "{{ home_dir }}/artifacts"
6-
installation_dir: "{{ home_dir }}/installation/{{ user_cloud }}/{{ ocp_cluster_name }}"
7-
osp_config_dir: "{{ home_dir }}/installation/{{ user_cloud }}/openstack"
17+
installation_dir: "{{ artifacts_dir }}/installation"
18+
user_cloud: "shiftstack"
19+
user_cloud_installation_dir: "{{ installation_dir }}/{{ user_cloud }}"
20+
osp_config_dir: "{{ user_cloud_installation_dir }}/openstack"
21+
ocp_cluster_name: "ostest"
22+
ocp_installation_dir: "{{ user_cloud_installation_dir }}/{{ ocp_cluster_name }}"
23+
kubeconfig: "{{ ocp_installation_dir }}/auth/kubeconfig"
24+
upi_playbooks_dir: "{{ ocp_installation_dir }}"
825
polarion_dir: "{{ artifacts_dir }}/test_results"
9-
kubeconfig: "{{ installation_dir }}/auth/kubeconfig"
10-
upi_playbooks_dir: "{{ installation_dir }}"
1126

1227
# Sets the Ansible Controller Node machine's HOME environment variable
1328
controller_home_dir: "{{ lookup('ansible.builtin.env', 'HOME') }}"
@@ -16,11 +31,11 @@ resources_file: "{{ controller_home_dir }}/artifacts/resources.yml"
1631
stage_unstable_flag: "{{ controller_home_dir }}/artifacts/stage_unstable_flag"
1732

1833
admin_cloud: "overcloud"
19-
admin_env_file: "{{ home_dir }}/{{ admin_cloud }}rc"
34+
admin_env_file: "{{ osp_config_dir }}/{{ admin_cloud }}rc"
2035
admin_verify_cacert: false
21-
user_cloud: "shiftstack"
22-
user_env_file: "{{ home_dir }}/{{ user_cloud }}rc"
23-
ocp_cluster_name: "ostest"
36+
user_env_file: "{{ osp_config_dir }}/{{ user_cloud }}rc"
37+
clouds_yaml_file_path: "{{ home_dir }}/.config/openstack/clouds.yaml"
38+
secure_yaml_file_path: "{{ home_dir }}/.config/openstack/secure.yaml"
2439

2540
topology:
2641
flavors:

0 commit comments

Comments
 (0)