boyoung | f42f2bf | 2017-10-16 19:06:30 +0900 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 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 | |
boyoung | 24b12a6 | 2017-10-12 10:32:44 +0900 | [diff] [blame] | 17 | --- |
| 18 | - hosts: {{ swarm_manager_address }} |
| 19 | become: true |
| 20 | tasks: |
| 21 | |
| 22 | {% if not delete -%} |
| 23 | |
| 24 | - name: make a directory for swarm archive image |
| 25 | file: |
| 26 | path: {{ image_dir }} |
| 27 | state: directory |
| 28 | mode: 0755 |
| 29 | - name: copy docker image file(.tar) to swarm manager node |
| 30 | copy: |
| 31 | src: {{ image_file_path }} |
| 32 | dest: {{ image_file_path }} |
| 33 | - name: load a docker image from archive file(example-abc.tar) |
| 34 | shell: docker load -i {{ image_file_path }} |
| 35 | - name: change tag information |
| 36 | shell: docker tag {{ image_name }} {{ swarm_manager_address }}:{{ docker_registry_port }}/{{ image_name }}:{{ image_tag }} |
| 37 | - name: push docker image to local registry |
| 38 | docker_image: |
| 39 | name: {{ swarm_manager_address }}:{{ docker_registry_port }}/{{ image_name }} |
| 40 | tag: {{ image_tag }} |
| 41 | push: yes |
| 42 | - name: Inspect a image |
| 43 | docker_image_facts: |
| 44 | name: {{ swarm_manager_address }}:{{ docker_registry_port }}/{{ image_name }}:{{ image_tag }} |
| 45 | |
| 46 | {% else -%} |
boyoung | f42f2bf | 2017-10-16 19:06:30 +0900 | [diff] [blame] | 47 | # Don't delete a docker image |
boyoung | 24b12a6 | 2017-10-12 10:32:44 +0900 | [diff] [blame] | 48 | {% endif %} |
| 49 | |