Skip to content

Commit

Permalink
Merge pull request #316 from reihl/use_version_filter
Browse files Browse the repository at this point in the history
Change when release_version to be more readable
  • Loading branch information
tonyskapunk authored May 29, 2024
2 parents 575709d + 8b500e8 commit 975b86c
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 21 deletions.
4 changes: 2 additions & 2 deletions roles/installer/tasks/23_rhcos_image_paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
rhcos_uri: "{{ rhcos_json.json | json_query('images.openstack.path') }}"
rhcos_path: "https://rhcos.mirror.openshift.com/art/storage/releases/rhcos-{{ base_version }}/{{ build_id }}/x86_64/"
tags: rhcospath
when: (release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int <= 7)
when: release_version is ansible.builtin.version('4.7', '<=')

- name: RHCOS image path (4.8+)
block:
Expand All @@ -61,4 +61,4 @@
rhcos_qemu_key: 'architectures.x86_64.artifacts.qemu.formats."qcow2.gz".disk.location'
rhcos_openstack_key: 'architectures.x86_64.artifacts.openstack.formats."qcow2.gz".disk.location'
tags: rhcospath
when: (release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 8)
when: release_version is ansible.builtin.version('4.8', '>=')
4 changes: 2 additions & 2 deletions roles/installer/tasks/24_rhcos_image_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
rhcos_qemu_sha256_unzipped: '{{ rhcos_json.json | json_query(''images.qemu."uncompressed-sha256"'') }}'
rhcos_sha256: "{{ rhcos_json.json | json_query('images.openstack.sha256') }}"
tags: cache
when: (release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int <= 7)
when: release_version is ansible.builtin.version('4.7', '<=')

- name: Set facts for RHCOS_QEMU_SHA256 and RHCOS_SHA256 (4.8+)
set_fact:
Expand All @@ -105,7 +105,7 @@
rhcos_qemu_sha_unzip_key: 'architectures.x86_64.artifacts.qemu.formats."qcow2.gz".disk."uncompressed-sha256"'
rhcos_openstack_sha_key: 'architectures.x86_64.artifacts.openstack.formats."qcow2.gz".disk.sha256'
tags: cache
when: (release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int >= 8)
when: release_version is ansible.builtin.version('4.8', '>=')

- name: Download {{ rhcos_qemu_uri }} for cache
get_url:
Expand Down
2 changes: 1 addition & 1 deletion roles/installer/tasks/40_create_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
group: "{{ ansible_user }}"
mode: '0644'
remote_src: true
when: (release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int <= 3)
when: release_version is ansible.builtin.version('4.3', '<=')
tags: manifests
2 changes: 1 addition & 1 deletion roles/installer/tasks/50_extramanifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
when:
- ipv6_enabled|bool
- dualstack_baremetal
- release_version.split('.')[0]|int == 4 and release_version.split('.')[1]|int < 8
- release_version is ansible.builtin.version('4.8', '<')
delegate_to: localhost

- name: Add Manifests from files dir
Expand Down
4 changes: 2 additions & 2 deletions roles/installer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- pullsecret
- extract
- include_tasks: 23_rhcos_image_paths.yml
when: ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int <= 3)) or cache_enabled|bool
when: release_version is ansible.builtin.version('4.3', '<=') or cache_enabled|bool
tags: rhcospath
- include_tasks: 24_rhcos_image_cache.yml
when: cache_enabled|bool
Expand All @@ -35,7 +35,7 @@
- include_tasks: 25_create-install-config.yml
tags: installconfig
- include_tasks: 30_create_metal3.yml
when: (release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int <= 3)
when: release_version is ansible.builtin.version('4.3', '<=')
tags: metal3config
- include_tasks: 40_create_manifest.yml
tags: manifests
Expand Down
10 changes: 6 additions & 4 deletions roles/node_prep/tasks/10_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
- always
- validation
when:
- version.split('.')[0]|int == 4 and version.split('.')[1]|int >= 12
- version is ansible.builtin.version('4.12', '>=')
- ipv6_enabled | bool
- dualstack_baremetal | bool
- dualstack_vips | bool
Expand Down Expand Up @@ -348,7 +348,9 @@
- name: Fail if dual-stack is requested and build does not support it
fail:
msg: This release {{ release_version }} does not support dual-stack deployments
when: release_version.split('.')[0]|int == 4 and release_version.split('.')[1]|int < 6 and dualstack_baremetal
when:
- release_version is ansible.builtin.version('4.6', '<')
- dualstack_baremetal | bool
tags:
- always
- validation
Expand Down Expand Up @@ -441,7 +443,7 @@
fail:
msg: "dnsvip variable is undefined or empty."
when:
- ((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int < 5))
- release_version is ansible.builtin.version('4.5', '<')
- ((dnsvip is undefined) or (dnsvip|length == 0))
tags:
- always
Expand Down Expand Up @@ -529,7 +531,7 @@
when:
- enable_virtualmedia|bool
- provisioningHostIP is undefined
- release_version.split('.')[0]|int == 4 and release_version.split('.')[1]|int == 6
- release_version is ansible.builtin.version('4.6', '==')
tags:
- always
- validation
Expand Down
10 changes: 4 additions & 6 deletions roles/node_prep/tasks/40_bridge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
state: present
when: (not enable_virtualmedia) and
((ipv4_provisioning|bool) or (not ipv6_enabled|bool) or
((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int == 3)))
(release_version is ansible.builtin.version('4.3', '==')))

- name: Create Bridge slave on provisioning nic ipv4
redhatci.ocp.nmcli:
Expand All @@ -80,7 +80,7 @@
state: present
when: (not enable_virtualmedia) and
((ipv4_provisioning|bool) or (not ipv6_enabled|bool) or
((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int == 3)))
(release_version is ansible.builtin.version('4.3', '==')))

- name: Create Bridge labeled provisioning bridge ipv6
redhatci.ocp.nmcli:
Expand All @@ -96,8 +96,7 @@
when:
- not enable_virtualmedia|bool
- ipv6_enabled|bool
- release_version.split('.')[0]|int == 4 and release_version.split('.')[1]|int > 3 or
release_version.split('.')[0]|int > 4
- release_version is ansible.builtin.version('4.3', '>')
- not ipv4_provisioning|bool

- name: Create Bridge slave on provisioning nic ipv6
Expand All @@ -112,8 +111,7 @@
when:
- not enable_virtualmedia|bool
- ipv6_enabled|bool
- release_version.split('.')[0]|int == 4 and release_version.split('.')[1]|int > 3 or
release_version.split('.')[0]|int > 4
- release_version is ansible.builtin.version('4.3', '>')
- not ipv4_provisioning|bool

- name: Create Bridge labeled {{ baremetal_bridge }} for ipv4
Expand Down
5 changes: 2 additions & 3 deletions roles/node_prep/tasks/45_networking_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
ip: "{{ ansible_facts[provisioning_bridge]['ipv4']['address'] }}/{{ ansible_facts[provisioning_bridge]['ipv4']['netmask'] }}"
when: (not enable_virtualmedia) and
((ipv4_provisioning|bool) or (not ipv6_enabled|bool) or
((release_version.split('.')[0]|int == 4) and (release_version.split('.')[1]|int == 3)))
(release_version is ansible.builtin.version('4.3', '==')))
tags:
- network_facts

Expand All @@ -50,8 +50,7 @@
- not enable_virtualmedia|bool
- ipv6_enabled|bool
- not ipv4_provisioning|bool
- release_version.split('.')[0]|int == 4 and release_version.split('.')[1]|int > 3 or
release_version.split('.')[0]|int > 4
- release_version is ansible.builtin.version('4.3', '>')
tags:
- network_facts

Expand Down

0 comments on commit 975b86c

Please sign in to comment.