X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=blueprints%2Fiotgateway%2Fplaybooks%2Froles%2Feg_registry%2Ftasks%2Finstall.yml;fp=blueprints%2Fiotgateway%2Fplaybooks%2Froles%2Feg_registry%2Ftasks%2Finstall.yml;h=443365d00e51a501cb29266437e269e625008d36;hb=98019264e44c1fb840c87ba81bc14f2df104f902;hp=0000000000000000000000000000000000000000;hpb=21d76c6999be0e33881c027411500b502139e343;p=eliot.git diff --git a/blueprints/iotgateway/playbooks/roles/eg_registry/tasks/install.yml b/blueprints/iotgateway/playbooks/roles/eg_registry/tasks/install.yml new file mode 100644 index 0000000..443365d --- /dev/null +++ b/blueprints/iotgateway/playbooks/roles/eg_registry/tasks/install.yml @@ -0,0 +1,106 @@ +# +# Copyright 2020 Huawei Technologies Co., Ltd. +# +# 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: Doing deployment setup for edge gallery + copy: + src: deploy + dest: /tmp/eg_registry/ + mode: 750 + +- name: Import config file + include_vars: + file: ../../../config.yml + name: vardata + +- name: Make dir for arm images + command: mkdir -p /tmp/eg_registry/armtarball + args: + chdir: /tmp/ + +- name: Set a variable + ansible.builtin.set_fact: + processor: "{{ vardata.master_edge_processor.name}}" + +- name: Downloading based on master_edge_processor value x86_64 tarball + command: wget http://release.edgegallery.org/x86/all/0.9.tar.gz + args: + chdir: /tmp/eg_registry/deploy/ + when: processor == "x86_64" + +- name: Download 0.9 tar arms based on master_edge_processor value + command: wget http://release.edgegallery.org/arm64/all/0.9.tar.gz + args: + chdir: /tmp/eg_registry/armtarball/ + when: ansible_architecture == 'aarch64' and processor == "x86_64" + +- name: Download 0.9 tar arms + command: wget http://release.edgegallery.org/arm64/all/0.9.tar.gz + args: + chdir: /tmp/eg_registry/deploy/ + when: ansible_architecture == 'aarch64' and processor != "x86_64" + +- name: Download 0.9 tar x86 + command: wget http://release.edgegallery.org/x86/all/0.9.tar.gz + args: + chdir: /tmp/eg_registry/deploy/ + when: ansible_architecture == 'x86_64' + +- name: Untar the donwloaded tar + command: tar -zxf 0.9.tar.gz + args: + chdir: /tmp/eg_registry/deploy/ + +- name: Untar the donwloaded tar + command: tar -zxf 0.9.tar.gz + args: + chdir: /tmp/eg_registry/armtarball/ + when: processor == "x86_64" + +- name: Registry replaced for cross playform + command: rm -rf /tmp/eg_registry/deploy/registry + when: processor == "x86_64" + +- name: Docker image replaced for cross playform + command: rm -rf /tmp/eg_registry/deploy/eg_swr_images/nginx#stable.tar.gz + when: processor == "x86_64" + +- name: Copy registry from x86 tarball + command: cp -r /tmp/eg_registry/armtarball/registry /tmp/eg_registry/deploy/ + when: processor == "x86_64" + +- name: Copy docker image from x86 tarball + # yamllint disable rule:line-length + command: cp -r /tmp/eg_registry/armtarball/eg_swr_images/nginx#stable.tar.gz /tmp/eg_registry/deploy/eg_swr_images/ + # yamllint disable rule:line-length + when: processor == "x86_64" + +- name: Replacing private ip + replace: + path: /tmp/eg_registry/deploy/load-images.sh + regexp: 'REGISTRIES_IP' + replace: "{{ vardata.private_repo_ip.name }}" + +- name: Replacing private port + replace: + path: /tmp/eg_registry/deploy/load-images.sh + regexp: 'REGISTRIES_PORT' + replace: "{{ vardata.docker_registry_port.name }}" + +- name: Execute the script + shell: + cmd: /tmp/eg_registry/deploy/load-images.sh