This commit is contained in:
22
ansible/roles/load_additional_components/defaults/main.yml
Normal file
22
ansible/roles/load_additional_components/defaults/main.yml
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
# 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.
|
||||
---
|
||||
|
||||
additional_registry_images: ""
|
||||
additional_registry_images_list: ""
|
||||
additional_url_images: ""
|
||||
additional_url_images_list: ""
|
||||
additional_executables: ""
|
||||
additional_executables_list: ""
|
||||
additional_executables_destination_path: ""
|
@ -0,0 +1,22 @@
|
||||
# Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
# 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: Download additional executables
|
||||
get_url:
|
||||
url: "{{ item }}"
|
||||
dest: "{{ additional_executables_destination_path }}"
|
||||
mode: 0711
|
||||
loop: "{{ additional_executables_list.split(',') }}"
|
||||
retries: 5
|
||||
delay: 3
|
23
ansible/roles/load_additional_components/tasks/main.yml
Normal file
23
ansible/roles/load_additional_components/tasks/main.yml
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
# 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.
|
||||
---
|
||||
- import_tasks: executables.yml
|
||||
when: additional_executables | bool
|
||||
|
||||
- import_tasks: registry.yml
|
||||
when: additional_registry_images | bool
|
||||
|
||||
- import_tasks: url.yml
|
||||
when: additional_url_images | bool
|
||||
|
19
ansible/roles/load_additional_components/tasks/registry.yml
Normal file
19
ansible/roles/load_additional_components/tasks/registry.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
# 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: Pull additional images from registry
|
||||
shell: 'CONTAINERD_NAMESPACE="k8s.io" {{ sysusr_prefix }}/bin/ctr --address={{ containerd_cri_socket }} images pull {{ item }}'
|
||||
loop: "{{ additional_registry_images_list.split(',') }}"
|
||||
retries: 5
|
||||
delay: 3
|
37
ansible/roles/load_additional_components/tasks/url.yml
Normal file
37
ansible/roles/load_additional_components/tasks/url.yml
Normal file
@ -0,0 +1,37 @@
|
||||
# Copyright 2021 The Kubernetes Authors.
|
||||
|
||||
# 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: Create temporary download dir
|
||||
file:
|
||||
path: /tmp/images
|
||||
state: directory
|
||||
|
||||
- name: Download additional images from url
|
||||
get_url:
|
||||
url: "{{ item }}"
|
||||
dest: "/tmp/images/"
|
||||
mode: 0600
|
||||
register: images
|
||||
loop: "{{ additional_url_images_list.split(',') }}"
|
||||
retries: 5
|
||||
delay: 3
|
||||
|
||||
- name: Load additional images
|
||||
shell: 'CONTAINERD_NAMESPACE="k8s.io" {{ sysusr_prefix }}/bin/ctr --address={{ containerd_cri_socket }} images import --no-unpack {{ item.dest }}'
|
||||
loop: "{{ images.results }}"
|
||||
|
||||
- name: Remove downloaded files
|
||||
file:
|
||||
state: absent
|
||||
path: "/tmp/images"
|
Reference in New Issue
Block a user