Richard Felkl | 4143a0e | 2017-02-01 23:24:13 +0100 | [diff] [blame] | 1 | {%- from "glance/map.jinja" import client with context %} |
| 2 | {%- if client.enabled %} |
| 3 | |
| 4 | glance_client_packages: |
| 5 | pkg.installed: |
| 6 | - names: {{ client.pkgs }} |
| 7 | |
Oleh Hryhorov | 6de49c9 | 2018-05-21 12:53:59 +0000 | [diff] [blame] | 8 | {%- if client.cloud_name is defined %} |
| 9 | |
Vasyl Saienko | e8d0e59 | 2018-12-22 11:11:23 +0000 | [diff] [blame] | 10 | {%- for identity_name, identity in client.get('identity', {}).items() %} |
Oleh Hryhorov | 6de49c9 | 2018-05-21 12:53:59 +0000 | [diff] [blame] | 11 | {%- for image_name, image in identity.image.items() %} |
| 12 | |
| 13 | {%- set _image_properties = {} %} |
| 14 | {%- do _image_properties.update({'container_format': image.container_format}) %} |
| 15 | {%- do _image_properties.update({'disk_format': image.disk_format}) %} |
Vasyl Saienko | f157de5 | 2019-05-16 12:46:05 +0000 | [diff] [blame] | 16 | {%- do _image_properties.update({'protected': false}) %} |
Oleh Hryhorov | 6de49c9 | 2018-05-21 12:53:59 +0000 | [diff] [blame] | 17 | {%- do _image_properties.update({'tags': image.tags}) %} |
| 18 | {%- do _image_properties.update({'visibility': image.visibility}) %} |
| 19 | |
| 20 | glance_openstack_image_{{ image_name }}: |
| 21 | glancev2.image_present: |
| 22 | - cloud_name: {{ client.cloud_name }} |
| 23 | - name: {{ image.get('name', image_name) }} |
| 24 | - image_properties: {{ _image_properties }} |
| 25 | {%- if image.import_from_format is defined %} |
| 26 | - import_from_format: {{ image.import_from_format }} |
| 27 | {%- endif %} |
| 28 | {%- if image.location is defined %} |
| 29 | - location: {{ image.location }} |
| 30 | {%- endif %} |
| 31 | {%- if image.wait_timeout is defined %} |
| 32 | - timeout: {{ image.wait_timeout }} |
| 33 | {%- endif %} |
| 34 | {%- if image.checksum is defined %} |
| 35 | - checksum: {{ image.checksum }} |
| 36 | {%- endif %} |
| 37 | {%- endfor %} |
| 38 | {%- endfor %} |
| 39 | |
| 40 | |
| 41 | {%- else %} |
Vasyl Saienko | d7d18ed | 2018-12-22 18:10:24 +0000 | [diff] [blame] | 42 | {%- for identity_name, identity in client.get('identity', {}).items() %} |
Richard Felkl | 4143a0e | 2017-02-01 23:24:13 +0100 | [diff] [blame] | 43 | |
Benjamin Drung | 35de764 | 2018-02-14 23:54:30 +0100 | [diff] [blame] | 44 | {%- for image_name, image in identity.image.items() %} |
Richard Felkl | 4143a0e | 2017-02-01 23:24:13 +0100 | [diff] [blame] | 45 | |
| 46 | glance_openstack_image_{{ image_name }}: |
Elena Ezhova | 1c2ebae | 2017-07-03 18:29:05 +0400 | [diff] [blame] | 47 | glanceng.image_import: |
| 48 | - name: {{ image.get('name', image_name) }} |
Richard Felkl | 4143a0e | 2017-02-01 23:24:13 +0100 | [diff] [blame] | 49 | - profile: {{ identity_name }} |
Elena Ezhova | 1c2ebae | 2017-07-03 18:29:05 +0400 | [diff] [blame] | 50 | {%- if image.import_from_format is defined %} |
| 51 | - import_from_format: {{ image.import_from_format }} |
| 52 | {%- endif %} |
Richard Felkl | 4143a0e | 2017-02-01 23:24:13 +0100 | [diff] [blame] | 53 | {%- if image.visibility is defined %} |
| 54 | - visibility: {{ image.visibility }} |
| 55 | {%- endif %} |
| 56 | {%- if image.protected is defined %} |
| 57 | - protected: {{ image.protected }} |
| 58 | {%- endif %} |
| 59 | {%- if image.location is defined %} |
| 60 | - location: {{ image.location }} |
| 61 | {%- endif %} |
Elena Ezhova | 1c2ebae | 2017-07-03 18:29:05 +0400 | [diff] [blame] | 62 | {%- if image.tags is defined %} |
| 63 | - tags: {{ image.tags }} |
| 64 | {%- endif %} |
| 65 | {%- if image.disk_format is defined %} |
| 66 | - disk_format: {{ image.disk_format }} |
| 67 | {%- endif %} |
| 68 | {%- if image.container_format is defined %} |
| 69 | - container_format: {{ image.container_format }} |
| 70 | {%- endif %} |
| 71 | {%- if image.wait_timeout is defined %} |
| 72 | - timeout: {{ image.wait_timeout }} |
| 73 | {%- endif %} |
| 74 | {%- if image.checksum is defined %} |
| 75 | - checksum: {{ image.checksum }} |
| 76 | {%- endif %} |
Richard Felkl | 4143a0e | 2017-02-01 23:24:13 +0100 | [diff] [blame] | 77 | |
| 78 | {%- endfor %} |
| 79 | {%- endfor %} |
| 80 | |
Oleh Hryhorov | 6de49c9 | 2018-05-21 12:53:59 +0000 | [diff] [blame] | 81 | {%- endif %} |
| 82 | |
| 83 | {%- endif %} |