Updated Docker playbook to install Python library for managing containers; updated Podman playbook to set up containers
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
2026-09-29 23:31:41 -04:00
parent d0c201c1f3
commit 81e7ce6a4b
4 changed files with 79 additions and 0 deletions
+48
View File
@@ -53,3 +53,51 @@
ansible.builtin.command: podman --version
register: podman_version_output
changed_when: false
- name: Run Podman containers
hosts: ci_runners
become: true
tasks:
- name: Determine mount host paths
ansible.builtin.set_fact:
_mount_paths: >-
{{
_mount_paths | default([]) +
(item.value.volumes | map('regex_replace', ':.*$', '') | list)
}}
loop: "{{ podman_containers | default({}) | dict2items }}"
when:
- item.value.volumes is defined
- item.value.state | default('started') != 'absent'
- name: Check status of mount paths on host
ansible.builtin.stat:
path: "{{ item }}"
loop: "{{ _mount_paths | default([]) | unique }}"
register: _mount_stats
- name: Ensure container mount directories exist
ansible.builtin.file:
# If the target path exists and is a file/socket/link, create its parent dir.
# If it doesn't exist at all, create it as a directory.
path: "{{ (item.stat.exists and not item.stat.isdir) | ternary(item.item | dirname, item.item) }}"
state: directory
mode: "0755"
loop: "{{ _mount_stats.results }}"
# Skip creating anything if the file/socket already exists
when: not (item.stat.exists and not item.stat.isdir)
- name: Manage Podman containers
containers.podman.podman_container:
name: "{{ item.key }}"
image: "{{ item.value.image | default(omit) }}"
state: "{{ item.value.state | default('started') }}"
command: "{{ item.value.command | default(omit) }}"
ports: "{{ item.value.ports | default(omit) }}"
volumes: "{{ item.value.volumes | default(omit) }}"
env: "{{ item.value.env | default(omit) }}"
network: "{{ item.value.network | default(omit) }}"
privileged: "{{ item.value.privileged | default(false) }}"
recreate: "{{ item.value.recreate | default(false) }}"
generate_systemd: "{{ item.value.generate_systemd | default(omit) }}"
loop: "{{ podman_containers | default({}) | dict2items }}"