Files
ansible-pull/roles/podman/tasks/main.yml

65 lines
2.0 KiB
YAML

---
# tasks file for roles/podman
- name: Ensure NFS client utilities are installed
ansible.builtin.apt:
name: nfs-common
state: present
update_cache: yes
- name: Create local mount point for Podman NFS data
ansible.builtin.file:
path: "{{ podman_data_mount_point }}"
state: directory
mode: '0755'
owner: root
group: root
- name: Ensure Podman NFS share is mounted and configured in /etc/fstab
ansible.posix.mount:
src: "{{ podman_nfs_server }}:{{ podman_nfs_share_path }}"
path: "{{ podman_data_mount_point }}"
fstype: nfs
opts: defaults,hard,intr,noatime,nofail # 'nofail' verhindert, dass der Bootvorgang stoppt, wenn der NFS-Server nicht erreichbar ist.
state: mounted
- name: Install Podman and related tools
ansible.builtin.apt:
name:
- podman
- podman-docker # Bietet ein Docker-kompatibles CLI-Interface
- buildah # Tool zum Erstellen von OCI-Images
- skopeo # Tool zum Verschieben und Kopieren von Container-Images
state: present
update_cache: yes
- name: Ensure Podman systemd socket is enabled and running
ansible.builtin.systemd:
name: podman.socket
state: started
enabled: yes
# 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: Install podman-compose from repository
ansible.builtin.apt:
name: podman-compose
state: present
update_cache: yes
- name: Create directory for Portainer compose file
ansible.builtin.file:
path: "{{ podman_data_mount_point }}/compose/portainer"
state: directory
mode: '0755'
- 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"