|
| 1 | +--- |
| 2 | +# Copyright Red Hat, Inc. |
| 3 | +# All Rights Reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | +# not use this file except in compliance with the License. You may obtain |
| 7 | +# a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | +# License for the specific language governing permissions and limitations |
| 15 | +# under the License. |
| 16 | + |
| 17 | +# This task file configures insecure registries and ImageContentSourcePolicy |
| 18 | +# Can be used standalone from playbooks that don't need the full openshift_setup role |
| 19 | + |
| 20 | +- name: Add insecure registry |
| 21 | + when: cifmw_update_containers_registry is defined |
| 22 | + vars: |
| 23 | + all_registries: "{{ ([cifmw_update_containers_registry] + cifmw_openshift_setup_allowed_registries + cifmw_openshift_setup_allowed_extra_registries) | unique }}" |
| 24 | + kubernetes.core.k8s: |
| 25 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 26 | + api_key: "{{ cifmw_openshift_token | default(omit)}}" |
| 27 | + context: "{{ cifmw_openshift_context | default(omit)}}" |
| 28 | + merge_type: "merge" |
| 29 | + definition: |
| 30 | + apiVersion: config.openshift.io/v1 |
| 31 | + kind: Image |
| 32 | + metadata: |
| 33 | + name: cluster |
| 34 | + spec: |
| 35 | + registrySources: |
| 36 | + insecureRegistries: |
| 37 | + - "{{ cifmw_update_containers_registry }}" |
| 38 | + allowedRegistries: "{{ all_registries }}" |
| 39 | + |
| 40 | +- name: Create a ICSP with repository digest mirrors |
| 41 | + when: |
| 42 | + - cifmw_openshift_setup_digest_mirrors is defined |
| 43 | + - cifmw_openshift_setup_digest_mirrors | length > 0 |
| 44 | + kubernetes.core.k8s: |
| 45 | + kubeconfig: "{{ cifmw_openshift_kubeconfig }}" |
| 46 | + api_key: "{{ cifmw_openshift_token | default(omit)}}" |
| 47 | + context: "{{ cifmw_openshift_context | default(omit)}}" |
| 48 | + definition: |
| 49 | + apiVersion: operator.openshift.io/v1alpha1 |
| 50 | + kind: ImageContentSourcePolicy |
| 51 | + metadata: |
| 52 | + name: registry-digest-mirrors |
| 53 | + spec: |
| 54 | + repositoryDigestMirrors: "{{ cifmw_openshift_setup_digest_mirrors }}" |
0 commit comments