blob: a7f70534c233f9b638f97468c354470ef62cdad0 [file] [log] [blame]
---
# ============LICENSE_START=======================================================
# Copyright (C) 2019 The Nordix Foundation. 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.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
- name: Create directory to store container images
file:
path: "{{ containers_folder }}"
state: "{{ item }}"
with_items:
- absent
- directory
- name: create temporary file for docker images
tempfile:
state: file
suffix: temp
register: dockerpullfile
- name: Make List
shell: "echo {{ other_images[item.key].repo }}:{{ other_images[item.key].tag }} >> {{ dockerpullfile.path }}"
with_dict: "{{ other_images }}"
become: false
changed_when: false
- name: pull images
script: pull-images.sh -l {{ dockerpullfile.path }} -p 2 -c {{ containertool }}
become: true
changed_when: false
- name: create temporary file for save
tempfile:
state: file
suffix: temp
register: dockersavefile
- name: Save other container images
script:
/bin/echo {{ other_images[item.key].repo }}:{{ other_images[item.key].tag }} \
-o {{ other_images[item.key].repo | replace('/', '_') | replace(':', '_') }}_{{ other_images[item.key].tag }}.tar \
>> {{ dockersavefile.path }}
with_dict: "{{ other_images }}"
become: false
changed_when: false
- name: save images
script: save-images.sh -l {{ dockersavefile.path }} -c {{ containers_folder }} -i {{ containertool }}
become: true
changed_when: false
# NOTE (fdegir): archive fails due to wrong permissions so we fix them
- name: Fix container image permissions
file:
path: "{{ containers_folder }}"
state: directory
recurse: true
mode: 0755
become: true
# vim: set ts=2 sw=2 expandtab: