|
9 | 9 | set_fact:
|
10 | 10 | service_configuration: "{{ service_configuration_raw['content'] | b64decode | from_yaml }}"
|
11 | 11 |
|
| 12 | +- name: Check service is in update list |
| 13 | + set_fact: |
| 14 | + service_exists: true |
| 15 | + when: service_configuration.service in update_data[service_configuration.network] |
| 16 | + |
12 | 17 | - name: Extract docker image and version
|
13 | 18 | set_fact:
|
14 | 19 | service_docker_image: "{{ service_configuration.image.split(':') | first }}"
|
15 | 20 | service_docker_image_tag: "{{ service_configuration.image.split(':') | last }}"
|
16 |
| - when: service_configuration.autoupdate |
| 21 | + when: service_exists is defined and service_configuration.autoupdate |
17 | 22 |
|
18 | 23 | - name: Get latest version for this service
|
19 | 24 | set_fact:
|
20 | 25 | new_service_docker_image_tag: "{{ update_data[service_configuration.network][service_configuration.service] | default(update_data['stratis'][service_configuration.service]) | last }}"
|
21 |
| - when: service_configuration.autoupdate and service_configuration.service != 'CustomService' |
| 26 | + when: service_exists is defined and service_configuration.autoupdate and service_configuration.service != 'CustomService' |
22 | 27 |
|
23 | 28 | - name: Build new image tag
|
24 | 29 | set_fact:
|
25 | 30 | new_service_configuration_fraction:
|
26 | 31 | image: "{{ service_docker_image }}:{{ new_service_docker_image_tag }}"
|
27 |
| - when: service_configuration.autoupdate |
| 32 | + when: service_exists is defined and service_configuration.autoupdate |
28 | 33 |
|
29 | 34 | - name: Update configuration
|
30 | 35 | set_fact:
|
31 | 36 | new_service_configuration: "{{ service_configuration | combine(new_service_configuration_fraction) }}"
|
32 |
| - when: service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest') |
| 37 | + when: service_exists is defined and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest') |
33 | 38 |
|
34 | 39 | - name: Write configuration
|
35 | 40 | copy:
|
|
38 | 43 | owner: "root"
|
39 | 44 | group: "root"
|
40 | 45 | mode: 0644
|
41 |
| - when: service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest') |
| 46 | + when: service_exists is defined and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest') |
42 | 47 | become: yes
|
43 | 48 |
|
44 | 49 | - name: Update configuration file modification time
|
45 | 50 | file:
|
46 | 51 | path: "/etc/stereum/services/{{ item }}.yaml"
|
47 | 52 | state: touch
|
48 |
| - when: service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest') |
| 53 | + when: service_exists is defined and service_configuration.autoupdate and (new_service_docker_image_tag != service_docker_image_tag or new_service_docker_image_tag == 'latest') |
49 | 54 | become: yes
|
50 | 55 |
|
51 | 56 | # EOF
|
0 commit comments