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

Impove group_vars docs and move s390x vars to create-vm role #1361

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 4 additions & 15 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ excluded_pairs:
# e.g. - ['ubuntu-1804-lts', 'core_bpf']
# This can be removed once we have downloadable s390x eBPF drivers
- [ 'rhel-8-6-s390x', 'ebpf' ]
# Also exclude Power & core_bpf, since it is currently unsupported
- [ 'p', 'core_bpf' ]

virtual_machines:
Expand All @@ -37,9 +38,9 @@ virtual_machines:
project: rhel-s390x-cloud
families:
- rhel-8-6-s390x
#We have taken families name as "p" since there is a character limit for instance name
#in ibm cloud(56 chars max)

# We have taken families name as "p" since there is a character limit for instance name
# in ibm cloud (56 chars max)
rhel-ppc64le:
project: rhel-ppc64le-cloud
families:
Expand Down Expand Up @@ -109,15 +110,3 @@ virtual_machines:
project: sap-se-gcp-gardenlinux
images:
- "{{ lookup('file', 'group_vars/gardenlinux-image.txt') }}"


# IBM Cloud setup
# vpc_name: lei-vpc-toronto
vpc_id: r038-c4f8e233-4b56-44bd-af71-140ebd1664e9
# subnet_name: stackrox-ci-sn3
subnet_id: 02s7-0fca7f4f-7e53-40d5-a087-f8cb5d7ab682
zone: ca-tor-3
# ssh_key_name: acs-sshkey
ssh_key_id: r038-fb0260c7-c01d-45c8-8026-7d50042943b9
# vsi_resource_group: stackrox-ci-resource-group
vsi_resource_group_id: 1a33a6a9bd6e498f8115e9b1064bfa97
12 changes: 6 additions & 6 deletions ansible/roles/create-vm/tasks/create-s390x-vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
name: "{{ vsi_name }}"
state: available
id: "{{ vsi.resource.id | default(omit) }}"
vpc: "{{ vpc_id }}"
vpc: "{{ s390x_vpc_id }}"
profile: "{{ vsi_profile }}"
image: "{{ vsi_image_id }}"
resource_group: "{{ vsi_resource_group_id }}"
resource_group: "{{ s390x_vsi_resource_group_id }}"
keys:
- "{{ ssh_key_id }}"
- "{{ s390x_ssh_key_id }}"
primary_network_interface:
- subnet: "{{ subnet_id }}"
zone: "{{ zone }}"
- subnet: "{{ s390x_subnet_id }}"
zone: "{{ s390x_zone }}"
register: vsi

- name: Check for existing Floating IP
Expand All @@ -39,7 +39,7 @@
name: "{{ vsi_name }}-fip"
state: available
id: "{{ fip.resource.id | default(omit) }}"
resource_group: "{{ vsi_resource_group_id }}"
resource_group: "{{ s390x_vsi_resource_group_id }}"
target: "{{ vsi.resource.primary_network_interface[0]['id'] }}"
register: fip

Expand Down
13 changes: 12 additions & 1 deletion ansible/roles/create-vm/vars/s390x.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
---
#rhel-8-6-s390x
vsi_image_id: r038-0d89bf54-c28f-4dc4-bec0-0f8e03a74de3
vsi_profile: bz2-2x8
vsi_profile: bz2-2x8

# IBM Cloud setup
# vpc_name: lei-vpc-toronto
s390x_vpc_id: r038-c4f8e233-4b56-44bd-af71-140ebd1664e9
# subnet_name: stackrox-ci-sn3
s390x_subnet_id: 02s7-0fca7f4f-7e53-40d5-a087-f8cb5d7ab682
s390x_zone: ca-tor-3
# ssh_key_name: acs-sshkey
s390x_ssh_key_id: r038-fb0260c7-c01d-45c8-8026-7d50042943b9
# vsi_resource_group: stackrox-ci-resource-group
s390x_vsi_resource_group_id: 1a33a6a9bd6e498f8115e9b1064bfa97
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can group all of these in a s390x dictionary?

Suggested change
s390x_vpc_id: r038-c4f8e233-4b56-44bd-af71-140ebd1664e9
# subnet_name: stackrox-ci-sn3
s390x_subnet_id: 02s7-0fca7f4f-7e53-40d5-a087-f8cb5d7ab682
s390x_zone: ca-tor-3
# ssh_key_name: acs-sshkey
s390x_ssh_key_id: r038-fb0260c7-c01d-45c8-8026-7d50042943b9
# vsi_resource_group: stackrox-ci-resource-group
s390x_vsi_resource_group_id: 1a33a6a9bd6e498f8115e9b1064bfa97
s390x:
vpc_id: r038-c4f8e233-4b56-44bd-af71-140ebd1664e9
# subnet_name: stackrox-ci-sn3
subnet_id: 02s7-0fca7f4f-7e53-40d5-a087-f8cb5d7ab682
zone: ca-tor-3
# ssh_key_name: acs-sshkey
ssh_key_id: r038-fb0260c7-c01d-45c8-8026-7d50042943b9
# vsi_resource_group: stackrox-ci-resource-group
vsi_resource_group_id: 1a33a6a9bd6e498f8115e9b1064bfa97

According to the ansible docs we could then access them with dot notation, i.e: s390x.vpc_id
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#dictionary-variables

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is much cleaner, I'll implement it now