60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
---
|
|
|
|
- name: Install and configure Podman
|
|
hosts: ci_runners
|
|
become: true
|
|
|
|
vars:
|
|
# Packages common to both Debian and RHEL families
|
|
podman_base_packages:
|
|
- podman
|
|
- podman-docker
|
|
|
|
# Debian/Ubuntu specific packages
|
|
podman_debian_packages:
|
|
- podman-compose
|
|
|
|
# RHEL-family specific packages (adjust or add epel-release if compose is needed)
|
|
podman_rhel_packages: []
|
|
|
|
# Set to true if you need the Docker-compatible API socket (e.g., for Woodpecker CI)
|
|
podman_enable_socket: true
|
|
|
|
tasks:
|
|
- name: Gather distribution-specific facts
|
|
ansible.builtin.setup:
|
|
gather_subset:
|
|
- "!all"
|
|
- distribution
|
|
- os_family
|
|
|
|
- name: Install Podman packages on Debian/Ubuntu
|
|
ansible.builtin.apt:
|
|
name: "{{ podman_base_packages + podman_debian_packages }}"
|
|
state: present
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
when: ansible_facts['os_family'] == 'Debian'
|
|
|
|
- name: Install Podman packages on RHEL/Rocky/AlmaLinux/CentOS
|
|
ansible.builtin.dnf:
|
|
name: "{{ podman_base_packages + podman_rhel_packages }}"
|
|
state: present
|
|
when: ansible_facts['os_family'] == 'RedHat'
|
|
|
|
- name: Enable and start system-wide Podman socket
|
|
ansible.builtin.systemd:
|
|
name: podman.socket
|
|
state: started
|
|
enabled: true
|
|
when: podman_enable_socket
|
|
|
|
- name: Verify Podman installation
|
|
ansible.builtin.command: podman --version
|
|
register: podman_version_output
|
|
changed_when: false
|
|
|
|
- name: Show installed Podman version
|
|
ansible.builtin.debug:
|
|
msg: "Installed {{ podman_version_output.stdout }}"
|