podman rebuilt
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
# Ansible Role: podman
|
||||
|
||||
Diese Rolle installiert Podman und Portainer auf Debian-basierten Systemen.
|
||||
Diese Rolle installiert Podman und startet Portainer mithilfe von `podman-compose` auf Debian-basierten Systemen.
|
||||
Zusätzlich wird ein NFS-Share von einem TrueNAS-System gemountet, um persistente Daten für Podman-Container, einschließlich Portainer, zu speichern.
|
||||
|
||||
## Anforderungen
|
||||
|
||||
Diese Rolle wurde für Debian-basierte Systeme entwickelt und getestet.
|
||||
Sie erfordert `pip`, um `podman-compose` zu installieren. Stellen Sie sicher, dass `python3-pip` auf dem Zielsystem vorhanden ist.
|
||||
|
||||
Es wird davon ausgegangen, dass ein NFS-Share auf einem TrueNAS-System bereits konfiguriert und exportiert ist.
|
||||
|
||||
## Rollenvariablen
|
||||
|
||||
@@ -41,27 +41,24 @@
|
||||
# Dies stellt sicher, dass der Podman-Socket für die Kommunikation verfügbar ist,
|
||||
# insbesondere für Tools wie Portainer, die sich mit dem Socket verbinden.
|
||||
|
||||
- name: Create Portainer data directory on NFS share
|
||||
- name: Install podman-compose
|
||||
ansible.builtin.pip:
|
||||
name: podman-compose
|
||||
state: present
|
||||
|
||||
- name: Create directory for Portainer compose file
|
||||
ansible.builtin.file:
|
||||
path: "{{ portainer_data_path }}"
|
||||
path: "{{ podman_data_mount_point }}/compose/portainer"
|
||||
state: directory
|
||||
mode: '0755'
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
- name: Run Portainer container with Podman (using podman_container module)
|
||||
community.general.podman_container:
|
||||
name: "{{ portainer_name }}"
|
||||
image: "{{ portainer_image }}"
|
||||
state: started
|
||||
restart_policy: always
|
||||
ports:
|
||||
- "{{ portainer_edge_agent_port }}:8000"
|
||||
- "{{ portainer_web_port }}:9443"
|
||||
- "{{ portainer_legacy_port }}:9000"
|
||||
volume:
|
||||
# Map Podman socket to Docker socket path for Portainer compatibility
|
||||
- "/run/podman/podman.sock:/var/run/docker.sock"
|
||||
- "{{ portainer_data_path }}:/data"
|
||||
# This module is idempotent by nature and provides better state management.
|
||||
# Ensure 'community.general' collection is installed with `ansible-galaxy collection install community.general`.
|
||||
- name: Create Portainer compose file from template
|
||||
ansible.builtin.template:
|
||||
src: portainer-compose.yml.j2
|
||||
dest: "{{ podman_data_mount_point }}/compose/portainer/compose.yml"
|
||||
mode: '0644'
|
||||
|
||||
- name: Start Portainer container using podman-compose
|
||||
ansible.builtin.command:
|
||||
cmd: podman-compose up -d
|
||||
chdir: "{{ podman_data_mount_point }}/compose/portainer"
|
||||
17
roles/podman/templates/portainer-compose.yml.j2
Normal file
17
roles/podman/templates/portainer-compose.yml.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
portainer:
|
||||
image: "{{ portainer_image }}"
|
||||
container_name: "{{ portainer_name }}"
|
||||
ports:
|
||||
- "{{ portainer_edge_agent_port }}:8000"
|
||||
- "{{ portainer_legacy_port }}:9000"
|
||||
- "{{ portainer_web_port }}:9443"
|
||||
volumes:
|
||||
- "podman.sock:/var/run/docker.sock"
|
||||
- "{{ portainer_data_path }}:/data"
|
||||
- "{{ portainer_data_path }}"/logs:/logs
|
||||
- "{{ portainer_data_path }}"/certs:/certs
|
||||
restart: always
|
||||
Reference in New Issue
Block a user