--- # Copyright Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - name: Gather the configurations to be passed to dev-scripts. vars: devscripts_config_patches: >- {{ hostvars[inventory_hostname] | dict2items | selectattr("key", "match", "^cifmw_devscripts_config_overrides_patch.*") | sort(attribute='key') | map(attribute='value') | list }} ansible.builtin.set_fact: cacheable: true cifmw_devscripts_config: >- {{ cifmw_devscripts_config | default({}) | combine(item, recursive=true) }} loop: >- {{ [cifmw_devscripts_config_defaults] + [cifmw_devscripts_config_overrides] + devscripts_config_patches }} - name: Replace OCP version if "stable-" alias used when: - cifmw_devscripts_config.openshift_version.startswith("stable-") vars: _ocp_release_txt: "{{ lookup('ansible.builtin.url', 'https://mirror.openshift.com/pub/openshift-v4/clients/ocp/' ~ cifmw_devscripts_config.openshift_version ~ '/release.txt', split_lines=False) }}" _ocp_release_name: "{{ _ocp_release_txt | regex_search('^Name:.*', multiline=True) }}" _ocp_release_version: "{{ _ocp_release_name.split()[1] }}" ansible.builtin.set_fact: cifmw_devscripts_config: "{{ cifmw_devscripts_config | combine({'openshift_version': _ocp_release_version}) }}" - name: Ensure output directory exists become: true ansible.builtin.file: group: "{{ cifmw_devscripts_user }}" mode: "0755" owner: "{{ cifmw_devscripts_user }}" path: "{{ cifmw_devscripts_artifacts_dir }}" state: "directory" - name: Output built config for easier debugging ansible.builtin.copy: backup: true dest: "{{ cifmw_devscripts_artifacts_dir }}/devscripts-config.yml" content: "{{ cifmw_devscripts_config | to_nice_yaml}}" mode: "0644"