podman rebuilt
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
# Ansible Role: podman
|
# 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.
|
Zusätzlich wird ein NFS-Share von einem TrueNAS-System gemountet, um persistente Daten für Podman-Container, einschließlich Portainer, zu speichern.
|
||||||
|
|
||||||
## Anforderungen
|
## Anforderungen
|
||||||
|
|
||||||
Diese Rolle wurde für Debian-basierte Systeme entwickelt und getestet.
|
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.
|
Es wird davon ausgegangen, dass ein NFS-Share auf einem TrueNAS-System bereits konfiguriert und exportiert ist.
|
||||||
|
|
||||||
## Rollenvariablen
|
## Rollenvariablen
|
||||||
|
|||||||
@@ -41,27 +41,24 @@
|
|||||||
# Dies stellt sicher, dass der Podman-Socket für die Kommunikation verfügbar ist,
|
# 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.
|
# 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:
|
ansible.builtin.file:
|
||||||
path: "{{ portainer_data_path }}"
|
path: "{{ podman_data_mount_point }}/compose/portainer"
|
||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
mode: '0755'
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
|
|
||||||
- name: Run Portainer container with Podman (using podman_container module)
|
- name: Create Portainer compose file from template
|
||||||
community.general.podman_container:
|
ansible.builtin.template:
|
||||||
name: "{{ portainer_name }}"
|
src: portainer-compose.yml.j2
|
||||||
image: "{{ portainer_image }}"
|
dest: "{{ podman_data_mount_point }}/compose/portainer/compose.yml"
|
||||||
state: started
|
mode: '0644'
|
||||||
restart_policy: always
|
|
||||||
ports:
|
- name: Start Portainer container using podman-compose
|
||||||
- "{{ portainer_edge_agent_port }}:8000"
|
ansible.builtin.command:
|
||||||
- "{{ portainer_web_port }}:9443"
|
cmd: podman-compose up -d
|
||||||
- "{{ portainer_legacy_port }}:9000"
|
chdir: "{{ podman_data_mount_point }}/compose/portainer"
|
||||||
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`.
|
|
||||||
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