role_podman_nextcloud/tasks/containers.yml

54 lines
1.7 KiB
YAML

- name: Container tasks
block:
- name: Pod State created
containers.podman.podman_pod:
name: "pod_nextcloud"
state: created
share: ipc,uts
hostname: "{{ inventory_hostname | default('ansible_undefined_fact') }}"
restart_policy: always
- name: nextcloud Container State created
containers.podman.podman_container:
name: "nextcloud_app_1"
state: created
pod: "pod_nextcloud"
image: "docker.io/library/nextcloud:stable-fpm"
network: bridge
ports:
- 9000:9000
volumes:
- "/home/{{ user.name }}/nextcloud/data:/home/step"
env:
FOO: "bar"
VIRTUAL_HOST: "{{ inventory_hostname | default('ansible_undefined_fact') }}"
VIRTUAL_PROTO: "fcgi"
- name: NGINX Proxy Container State created
containers.podman.podman_container:
name: "nextcloud_nginx-proxy_1"
state: created
pod: "pod_nextcloud"
image: "docker.io/nginxproxy/nginx-proxy:latest"
network: bridge
ports:
- 8080:80
- 4443:443
volumes:
- "/home/{{ user.name }}/nginx/html:/usr/share/nginx/html"
- "/home/{{ user.name }}/nginx/certs:/etc/nginx/certs"
- "/run/user/{{ getent_passwd[user.name][2] }}/podman/podman.sock:/tmp/docker.sock:ro"
- name: Container State started
containers.podman.podman_container:
name: "{{ container_to_start }}"
state: started
pod: "pod_nextcloud"
with_items:
- "nextcloud_app_1"
- "nextcloud_nginx-proxy_1"
tags:
- init
loop_control:
loop_var: "container_to_start"