443365d00e51a501cb29266437e269e625008d36
[eliot.git] / blueprints / iotgateway / playbooks / roles / eg_registry / tasks / install.yml
1 #
2 # Copyright 2020 Huawei Technologies Co., Ltd.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 ---
18
19 - name: Doing deployment setup for edge gallery
20   copy:
21     src: deploy
22     dest: /tmp/eg_registry/
23     mode: 750
24
25 - name: Import config file
26   include_vars:
27     file: ../../../config.yml
28     name: vardata
29
30 - name: Make dir for arm images
31   command: mkdir -p /tmp/eg_registry/armtarball
32   args:
33     chdir: /tmp/
34
35 - name: Set a variable
36   ansible.builtin.set_fact:
37     processor: "{{ vardata.master_edge_processor.name}}"
38
39 - name: Downloading based on master_edge_processor value x86_64 tarball
40   command: wget http://release.edgegallery.org/x86/all/0.9.tar.gz
41   args:
42     chdir: /tmp/eg_registry/deploy/
43   when: processor == "x86_64"
44
45 - name: Download 0.9 tar arms based on master_edge_processor value
46   command: wget http://release.edgegallery.org/arm64/all/0.9.tar.gz
47   args:
48     chdir: /tmp/eg_registry/armtarball/
49   when: ansible_architecture == 'aarch64' and processor == "x86_64"
50
51 - name: Download 0.9 tar arms
52   command: wget http://release.edgegallery.org/arm64/all/0.9.tar.gz
53   args:
54     chdir: /tmp/eg_registry/deploy/
55   when: ansible_architecture == 'aarch64' and processor != "x86_64"
56
57 - name: Download 0.9 tar x86
58   command: wget http://release.edgegallery.org/x86/all/0.9.tar.gz
59   args:
60     chdir: /tmp/eg_registry/deploy/
61   when: ansible_architecture == 'x86_64'
62
63 - name: Untar the donwloaded tar
64   command: tar -zxf 0.9.tar.gz
65   args:
66     chdir: /tmp/eg_registry/deploy/
67
68 - name: Untar the donwloaded tar
69   command: tar -zxf 0.9.tar.gz
70   args:
71     chdir: /tmp/eg_registry/armtarball/
72   when: processor == "x86_64"
73
74 - name: Registry replaced for cross playform
75   command: rm -rf /tmp/eg_registry/deploy/registry
76   when: processor == "x86_64"
77
78 - name: Docker image replaced for cross playform
79   command: rm -rf /tmp/eg_registry/deploy/eg_swr_images/nginx#stable.tar.gz
80   when: processor == "x86_64"
81
82 - name: Copy registry from x86 tarball
83   command: cp -r /tmp/eg_registry/armtarball/registry /tmp/eg_registry/deploy/
84   when: processor == "x86_64"
85
86 - name: Copy docker image from x86 tarball
87   # yamllint disable rule:line-length
88   command: cp -r /tmp/eg_registry/armtarball/eg_swr_images/nginx#stable.tar.gz /tmp/eg_registry/deploy/eg_swr_images/
89   # yamllint disable rule:line-length
90   when: processor == "x86_64"
91
92 - name: Replacing private ip
93   replace:
94     path: /tmp/eg_registry/deploy/load-images.sh
95     regexp: 'REGISTRIES_IP'
96     replace: "{{ vardata.private_repo_ip.name }}"
97
98 - name: Replacing private port
99   replace:
100     path: /tmp/eg_registry/deploy/load-images.sh
101     regexp: 'REGISTRIES_PORT'
102     replace: "{{ vardata.docker_registry_port.name }}"
103
104 - name: Execute the script
105   shell:
106     cmd: /tmp/eg_registry/deploy/load-images.sh