Update Portainer across release channels
This commit is contained in:
@@ -44,12 +44,50 @@
|
||||
| map(attribute='item')
|
||||
| list }}
|
||||
|
||||
- name: Pull the latest release for each installed Portainer edition
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- docker
|
||||
- image
|
||||
- pull
|
||||
- >-
|
||||
{{ 'portainer/portainer-ee:' ~ portainer_target_tag
|
||||
if 'portainer-ee' in item.stdout
|
||||
else 'portainer/portainer-ce:' ~ portainer_target_tag }}
|
||||
loop: "{{ portainer_container_inspections.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.stdout }}"
|
||||
register: portainer_image_pulls
|
||||
changed_when: "'Downloaded newer image' in portainer_image_pulls.stdout"
|
||||
when:
|
||||
- item.stdout is match('^(?:[^/]+/)?portainer/(?:portainer|portainer-(?:ce|ee))(?::|@|$)')
|
||||
- not ansible_check_mode
|
||||
|
||||
- name: Point the existing image reference at the latest release
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- docker
|
||||
- image
|
||||
- tag
|
||||
- >-
|
||||
{{ 'portainer/portainer-ee:' ~ portainer_target_tag
|
||||
if 'portainer-ee' in item.stdout
|
||||
else 'portainer/portainer-ce:' ~ portainer_target_tag }}
|
||||
- "{{ item.stdout }}"
|
||||
loop: "{{ portainer_container_inspections.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.stdout }}"
|
||||
changed_when: false
|
||||
when:
|
||||
- item.stdout is match('^(?:[^/]+/)?portainer/(?:portainer|portainer-(?:ce|ee))(?::|$)')
|
||||
- not ansible_check_mode
|
||||
|
||||
- name: Update discovered Portainer containers
|
||||
ansible.builtin.command:
|
||||
argv: >-
|
||||
{{ ['docker', 'run', '--rm', '--pull', 'always',
|
||||
'--volume', '/var/run/docker.sock:/var/run/docker.sock',
|
||||
portainer_watchtower_image, '--run-once', '--cleanup',
|
||||
portainer_watchtower_image, '--run-once', '--cleanup', '--no-pull',
|
||||
'--include-stopped']
|
||||
+ portainer_container_ids }}
|
||||
register: portainer_watchtower
|
||||
|
||||
Reference in New Issue
Block a user