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
+15
View File
@@ -0,0 +1,15 @@
---
podman_containers:
woodpecker_agent:
image: docker.io/woodpeckerci/woodpecker-agent:v3.16
state: started
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
env:
WOODPECKER_BACKEND=docker
WOODPECKER_SERVER=10.7.10.84:9000
WOODPECKER_AGENT_SECRET=af2c22a8f27fe2c22249d3b1e42f92df
generate_systemd:
restart_policy: always
names: true
+10
View File
@@ -6,3 +6,13 @@
roles: roles:
- geerlingguy.docker - geerlingguy.docker
- name: Ensure python3-docker is installed
hosts: ci_servers
become: true
tasks:
- name: Install python3-docker
ansible.builtin.package:
name:
- python3-docker
state: present
+48
View File
@@ -53,3 +53,51 @@
ansible.builtin.command: podman --version ansible.builtin.command: podman --version
register: podman_version_output register: podman_version_output
changed_when: false 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 }}"
+6
View File
@@ -1,6 +1,12 @@
collections: collections:
- name: ansible.posix - name: ansible.posix
version: 2.2.2
- name: community.general - name: community.general
version: 13.4.0
- name: community.docker
version: 5.3.0
- name: containers.podman
version: 1.20.2
roles: roles:
- name: gballan.sssd - name: gballan.sssd