Files
ansible-collection-kolla/roles/podman/tasks/install.yml
Michal Nasiadka 3d665fdb9d ansible-lint: Fix key-order[task]
Change-Id: I92c53b1c3f2695430e8f66b4add2ab7c070c7895
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
2025-11-21 13:33:04 +00:00

51 lines
1.4 KiB
YAML

---
# Upgrading podman engine may cause containers to stop. Take a snapshot of the
# running containers prior to a potential upgrade of Podman.
- name: Check which containers are running
command: podman ps -f 'status=running' -q
become: true
# If Podman is not installed this command may exit non-zero.
failed_when: false
changed_when: false
register: running_containers
- name: Install packages
package:
name: "{{ podman_packages | select | list }}"
cache_valid_time: "{{ apt_cache_valid_time if ansible_facts.os_family == 'Debian' else omit }}"
update_cache: true
state: present
become: true
register: podman_install_result
# If any packages were updated, and any containers were running, wait for the
# daemon to come up and start all previously running containers.
- name: Start podman.socket
become: true
service:
name: podman.socket
state: started
enabled: true
- when:
- podman_install_result.changed
- running_containers.rc == 0
- running_containers.stdout != ''
block:
- name: Wait for Podman to start
command: podman info
become: true
changed_when: false
register: result
until: result is success
retries: 6
delay: 10
- name: Ensure containers are running after Podman upgrade
command: "podman start {{ running_containers.stdout }}"
become: true
changed_when: true
- import_tasks: config.yml