blob: c42f4e21dc4f839cf57b6cbff0b9ca33f0cc1922 [file] [log] [blame]
Fatih Degirmenci50b146b2019-05-10 14:11:57 +02001---
2# ============LICENSE_START=======================================================
3# Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4# ================================================================================
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain 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,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# SPDX-License-Identifier: Apache-2.0
18# ============LICENSE_END=========================================================
Fatih Degirmencidf251d52019-12-11 13:43:10 +010019- name: Set download source and destination for the deployment image
20 set_fact:
Fatih Degirmenci50b146b2019-05-10 14:11:57 +020021 source: "{{ item.source }}"
22 destination: "{{ item.destination }}"
23 download_image: "{{ item.download }}"
24
25- block:
26 - name: Remove existing image {{ destination }}
27 file:
28 path: "{{ destination }}"
29 state: absent
30
31 - name: Get sha256sum of image {{ source }}
32 uri:
33 url: "{{ source }}"
34 method: HEAD
35 register: header
36
37 - name: Download image
38 get_url:
39 url: "{{ source }}"
40 dest: "{{ destination }}"
41 mode: 0644
42 sha256sum: "{{ header.x_checksum_sha256 }}"
43 when: download_image
44 become: yes