Hakwit added in edge
[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: Docker image replaced for cross playform tool chain
83   # yamllint disable rule:line-length
84   command: rm -rf /tmp/eg_registry/deploy/eg_swr_images/edgegallery@deploy-tool#latest.tar.gz
85   # yamllint disable rule:line-length
86   when: processor == "x86_64"
87
88 - name: Copy registry from x86 tarball
89   command: cp -r /tmp/eg_registry/armtarball/registry /tmp/eg_registry/deploy/
90   when: processor == "x86_64"
91
92 - name: Copy docker image from x86 tarball
93   # yamllint disable rule:line-length
94   command: cp -r /tmp/eg_registry/armtarball/eg_swr_images/nginx#stable.tar.gz /tmp/eg_registry/deploy/eg_swr_images/
95   # yamllint disable rule:line-length
96   when: processor == "x86_64"
97
98 - name: Copy docker image from x86 tarball tool chain
99   # yamllint disable rule:line-length
100   command: cp -r /tmp/eg_registry/armtarball/eg_swr_images/edgegallery@deploy-tool#latest.tar.gz /tmp/eg_registry/deploy/eg_swr_images/
101   # yamllint disable rule:line-length
102   when: processor == "x86_64"
103
104 - name: Replacing private ip
105   replace:
106     path: /tmp/eg_registry/deploy/load-images.sh
107     regexp: 'REGISTRIES_IP'
108     replace: "{{ vardata.private_repo_ip.name }}"
109
110 - name: Replacing private port
111   replace:
112     path: /tmp/eg_registry/deploy/load-images.sh
113     regexp: 'REGISTRIES_PORT'
114     replace: "{{ vardata.docker_registry_port.name }}"
115
116 - name: Execute the script
117   shell:
118     cmd: /tmp/eg_registry/deploy/load-images.sh