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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 - name: List docker images and tags
18 hosts: "{{ groups.caas_master[0] | default('nowhere') }}"
23 register: images_result
24 command: '/usr/bin/curl -sS
25 --key /etc/docker-registry/registry{{ nodeindex }}-key.pem
26 --cert /etc/docker-registry/registry{{ nodeindex }}.pem
27 {{ caas.registry }}/v2/_catalog'
29 - name: Get tags from image names
31 command: '/usr/bin/curl -sS
32 --key /etc/docker-registry/registry{{ nodeindex }}-key.pem
33 --cert /etc/docker-registry/registry{{ nodeindex }}.pem
34 -H "Accept: application/vnd.docker.distribution.manifest.v2+json"
35 {{ caas.registry }}/v2/{{ item }}/tags/list'
37 - "{{ (images_result.stdout|from_json).repositories }}"
39 - name: List of image names and tags
41 image_names_and_tags: {}
43 - name: Create images names and tags dictionary
45 image_names_and_tags: "{{ image_names_and_tags|combine( {(item.stdout|from_json).name: (item.stdout|from_json).tags} ) }}"
47 - "{{ tags_result.results }}"
49 - name: Create a json from list of docker images and tags
51 src: "return_value_list_docker_images.j2"
52 dest: "/tmp/return_value_list_docker_images.json"