Compare commits

...

12 Commits

17 changed files with 825 additions and 115 deletions

View File

@@ -0,0 +1,99 @@
---
- hosts: all
name: Gitea web server
tasks:
- name: Get containers UID
ansible.builtin.command: "id -u containers"
register: uid_containers
changed_when: uid_containers.rc != 0
- name: Stop running containers
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
state: stopped
loop:
- act_runner
failed_when: false
- name: Create podman volumes
containers.podman.podman_volume:
state: present
name: "{{ item }}"
become_user: containers
become: true
loop:
- act_runner
- name: Pull container images
become_user: containers
become: true
containers.podman.podman_image:
name: docker.io/{{ item }}
loop:
- gitea/act_runner:latest
- name: Change permission to act_runner folder
become_user: root
become: true
ansible.builtin.file:
path: /etc/act_runner
owner: containers
group: containers
mode: "0700"
state: directory
- name: Copy config directory
become_user: root
become: true
ansible.builtin.template:
src: "templates/{{ item }}.j2"
dest: "/etc/act_runner/{{ item }}"
owner: containers
group: containers
mode: "0600"
loop:
- configuration.yml
- name: Create act_runner instance
become_user: containers
become: true
containers.podman.podman_container:
name: act_runner
image: gitea/act_runner:latest
state: present
security_opt:
# - label=type:container_runtime_t
- label=disable
device:
- /dev/fuse
publish:
- "8088:8088"
volume:
- act_runner:/data:Z
- /etc/act_runner:/config:Z
- /run/user/{{ uid_containers.stdout }}/podman/podman.sock:/var/run/docker.sock:z
env:
GITEA_INSTANCE_URL: "{{ vault_act_runner_host }}"
GITEA_RUNNER_REGISTRATION_TOKEN: "{{ vault_act_runner_token }}"
GITEA_RUNNER_NAME: "{{ inventory_hostname_short }}"
CONFIG_FILE: "/config/configuration.yml"
generate_systemd:
path: /home/containers/.config/systemd/user/
restart_policy: on-failure
names: true
new: true
- name: Start containers at boot
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
enabled: true
state: started
daemon_reload: true
loop:
- act_runner

View File

@@ -0,0 +1,85 @@
# Example configuration file, it's safe to copy this as the default config file without any modification.
# You don't have to copy this file to your instance,
# just run `./act_runner generate-config > config.yaml` to generate a config file.
log:
# The level of logging, can be trace, debug, info, warn, error, fatal
level: info
runner:
# Where to store the registration result.
file: .runner
# Execute how many tasks concurrently at the same time.
capacity: {{ vault_act_runner_capacity }}
# Extra environment variables to run jobs.
#envs:
# Extra environment variables to run jobs from a file.
# It will be ignored if it's empty or the file doesn't exist.
#env_file: .env
# The timeout for a job to be finished.
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
timeout: 3h
# Whether skip verifying the TLS certificate of the Gitea instance.
insecure: false
# The timeout for fetching the job from the Gitea instance.
fetch_timeout: 5s
# The interval for fetching the job from the Gitea instance.
fetch_interval: 2s
# The labels of a runner are used to determine which jobs the runner can run, and how to run them.
# Like: ["macos-arm64:host", "ubuntu-latest:docker://node:16-bullseye", "ubuntu-22.04:docker://node:16-bullseye"]
# If it's empty when registering, it will ask for inputting labels.
# If it's empty when execute `deamon`, will use labels in `.runner` file.
labels: [linux,self-hosted]
cache:
# Enable cache server to use actions/cache.
enabled: true
# The directory to store the cache data.
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
dir: ""
# The host of the cache server.
# It's not for the address to listen, but the address to connect from job containers.
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
host: "{{ ansible_facts[vault_act_net_interface_name]['ipv4']['address'] }}"
# The port of the cache server.
# 0 means to use a random available port.
port: 8088
# The external cache server URL. Valid only when enable is true.
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
# The URL should generally end with "/".
external_server: ""
container:
# Specifies the network to which the container will connect.
# Could be host, bridge or the name of a custom network.
# If it's empty, act_runner will create a network automatically.
network: ""
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
privileged: false
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
options:
# The parent directory of a job's working directory.
# If it's empty, /workspace will be used.
workdir_parent:
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
# You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
# For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
# valid_volumes:
# - data
# - /src/*.json
# If you want to allow any volume, please use the following configuration:
# valid_volumes:
# - '**'
valid_volumes: [build_cache]
# overrides the docker client host with the specified one.
# If it's empty, act_runner will find an available docker host automatically.
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
docker_host: "-"
host:
# The parent directory of a job's working directory.
# If it's empty, $HOME/.cache/act/ will be used.
workdir_parent:

View File

@@ -13,6 +13,7 @@
state: stopped state: stopped
loop: loop:
- collabora - collabora
failed_when: false
# - name: Create podman volumes # - name: Create podman volumes
# containers.podman.podman_volume: # containers.podman.podman_volume:
@@ -49,8 +50,6 @@
name: collabora name: collabora
image: docker.io/collabora/code:latest image: docker.io/collabora/code:latest
state: present state: present
cap_add:
- MKNOD
network: network:
- traefik-collabora - traefik-collabora
- nextcloud-collabora - nextcloud-collabora
@@ -60,7 +59,7 @@
io.containers.autoupdate: "registry" io.containers.autoupdate: "registry"
traefik.enable: "true" traefik.enable: "true"
traefik.http.routers.collabora.entrypoints: "https" traefik.http.routers.collabora.entrypoints: "https"
traefik.http.routers.collabora.rule: "Host(`{{ vault_domain }}`) && PathPrefix(`/collabora`,`/browser`)" traefik.http.routers.collabora.rule: "Host(`{{ vault_domain }}`) && (PathPrefix(`/collabora`) || Path(`/browser`))"
traefik.http.routers.collabora.tls: "true" traefik.http.routers.collabora.tls: "true"
traefik.http.routers.collabora.tls.certresolver: "wildcard" traefik.http.routers.collabora.tls.certresolver: "wildcard"
traefik.http.routers.collabora.service: "collabora" traefik.http.routers.collabora.service: "collabora"
@@ -69,16 +68,32 @@
env: env:
domain: "chef\\.heaplab\\.deib\\.polimi\\.it" domain: "chef\\.heaplab\\.deib\\.polimi\\.it"
aliasgroup1: "chef\\.heaplab\\.deib\\.polimi\\.it" aliasgroup1: "chef\\.heaplab\\.deib\\.polimi\\.it"
server_name: "chef.heaplab.deib.polimi.it"
username: "{{ vault_collabora_user }}" username: "{{ vault_collabora_user }}"
password: "{{ vault_collabora_password }}" password: "{{ vault_collabora_password }}"
extra_params: "--o:ssl.enable=false --o:ssl.termination=true --o:net.service_root=/collabora" extra_params: "--o:ssl.enable=false --o:ssl.termination=true --o:net.service_root=/collabora --o:net.server_name=chef.heaplab.deib.polimi.it/collabora"
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600 requires: [container-nextcloud.service, container-traefik.service]
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-collabora.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -13,6 +13,7 @@
state: stopped state: stopped
loop: loop:
- drone-runner - drone-runner
failed_when: false
- name: Get containers UID - name: Get containers UID
ansible.builtin.command: "id -u containers" ansible.builtin.command: "id -u containers"
@@ -83,10 +84,24 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-drone-runner.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -13,6 +13,7 @@
state: stopped state: stopped
loop: loop:
- drone-server - drone-server
failed_when: false
- name: Create podman volumes - name: Create podman volumes
containers.podman.podman_volume: containers.podman.podman_volume:
@@ -84,10 +85,25 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600 requires: [container-traefik.service]
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-drone-server.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -14,6 +14,7 @@
loop: loop:
- gitea - gitea
- db_gitea - db_gitea
failed_when: false
- name: Permit traffic from any IP to ssh port - name: Permit traffic from any IP to ssh port
become: true become: true
@@ -62,7 +63,7 @@
dest: /etc/gitea/mariadb/ dest: /etc/gitea/mariadb/
owner: containers owner: containers
group: containers group: containers
mode: 0600 mode: "0600"
- name: Create mariadb instance - name: Create mariadb instance
become_user: containers become_user: containers
@@ -88,7 +89,6 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600
names: true names: true
new: true new: true
@@ -155,16 +155,46 @@
GITEA__service__SIGNIN_VIEW: false GITEA__service__SIGNIN_VIEW: false
GITEA__service__REGISTER_EMAIL_CONFIRM: true GITEA__service__REGISTER_EMAIL_CONFIRM: true
GITEA__service__ENABLE_CAPTCHA: true GITEA__service__ENABLE_CAPTCHA: true
GITEA__service__ENABLE_NOTIFY_MAIL: true
GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE: false GITEA__service__DEFAULT_KEEP_EMAIL_PRIVATE: false
GITEA__ui__THEMES: "auto,gitea,arc-green,gitea-modern" GITEA__ui__THEMES: "auto,gitea,arc-green,gitea-modern"
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
requires: [container-db_gitea] requires: [container-db_gitea.service, container-traefik.service]
time: 3600
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-gitea.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-db_gitea.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -13,6 +13,7 @@
state: stopped state: stopped
loop: loop:
- heimdall - heimdall
failed_when: false
- name: Create podman volumes - name: Create podman volumes
containers.podman.podman_volume: containers.podman.podman_volume:
@@ -77,10 +78,25 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600 requires: [container-traefik.service]
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-heimdall.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -0,0 +1,183 @@
# code: language=ansible
---
- hosts: all
name: Mattermost server
tasks:
- name: Stop running containers
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
state: stopped
loop:
- mattermost
- db_mattermost
failed_when: false
- name: Create podman volumes
containers.podman.podman_volume:
state: present
name: "{{ item }}"
become_user: containers
become: true
loop:
- mattermost-config
- mattermost-data
- mattermost-logs
- mattermost-plugins
- mattermost-clientplugins
- mattermost-bleveindexes
- mattermost-db
- name: Create podman networks
containers.podman.podman_network:
name: "{{ item }}"
recreate: false
state: "present"
become_user: containers
become: true
loop:
- traefik-mattermost
- postgres-mattermost
- name: Pull container images
become_user: containers
become: true
containers.podman.podman_image:
name: docker.io/{{ item }}
loop:
- mattermost/mattermost-team-edition:release-9
- postgres:13-alpine
- name: Create postgres instance
become_user: containers
become: true
containers.podman.podman_container:
name: db_mattermost
image: docker.io/postgres:13-alpine
state: present
volume:
- mattermost-db:/var/lib/postgresql/data/pgdata:Z
network:
- postgres-mattermost
env:
POSTGRES_DB: "{{ vault_mattermost_db_database }}"
POSTGRES_USER: "{{ vault_mattermost_db_user }}"
POSTGRES_PASSWORD: "{{ vault_mattermost_db_password }}"
PGDATA: /var/lib/postgresql/data/pgdata
TZ: "{{ vault_timezone }}"
security_opt:
- no-new-privileges=true
pids_limit: "100"
read_only: true
tmpfs:
"/tmp": "rw"
"/var/run/postgresql": "rw"
generate_systemd:
path: /home/containers/.config/systemd/user/
restart_policy: on-failure
names: true
new: true
- name: Add a mattermost container
become_user: containers
become: true
containers.podman.podman_container:
name: mattermost
image: docker.io/mattermost/mattermost-team-edition:release-9
state: present
network:
- traefik-mattermost
- postgres-mattermost
volume:
- mattermost-config:/mattermost/config:Z
- mattermost-data:/mattermost/data:Z
- mattermost-logs:/mattermost/logs:Z
- mattermost-plugins:/mattermost/plugins:Z
- mattermost-clientplugins:/mattermost/client/plugins:Z
- mattermost-bleveindexes:/mattermost/bleve-indexes:Z
security_opt:
- no-new-privileges=true
pids_limit: "100"
tmpfs:
"/tmp": "rw"
label:
io.containers.autoupdate: "registry"
traefik.enable: "true"
traefik.http.routers.mattermost.entrypoints: "https"
traefik.http.routers.mattermost.rule: "Host(`{{ vault_domain }}`) && (PathPrefix(`/mattermost/`) || Path(`/mattermost`))"
traefik.http.routers.mattermost.tls: "true"
traefik.http.routers.mattermost.tls.certresolver: "wildcard"
traefik.http.routers.mattermost.service: "mattermost"
traefik.http.routers.mattermost.middlewares: "http-compress@file"
traefik.http.services.mattermost.loadbalancer.server.port: "8065"
traefik.http.services.mattermost.loadbalancer.passhostheader: "true"
traefik.udp.routers.mm-call-rtr.service: "mm-call-svc"
traefik.udp.routers.mm-call-rtr.entrypoints: "mmcalls"
traefik.udp.services.mm-call-svc.loadBalancer.server.port: "8443"
traefik.docker.network: "traefik-mattermost"
env:
TZ: "{{ vault_timezone }}"
# https://docs.mattermost.com/configure/environment-configuration-settings.html
MM_SQLSETTINGS_DRIVERNAME: "postgres"
MM_SQLSETTINGS_DATASOURCE: "postgres://{{ vault_mattermost_db_user }}:{{ vault_mattermost_db_password }}@db_mattermost:5432/{{ vault_mattermost_db_database }}?sslmode=disable&connect_timeout=10"
MM_BLEVESETTINGS_INDEXDIR: "/mattermost/bleve-indexes"
MM_SERVICESETTINGS_SITEURL: "https://{{ vault_domain }}/mattermost"
MM_EMAILSETTINGS_SMTPSERVER: "{{ vault_smtp_host }}"
MM_EMAILSETTINGS_SMTPPORT: "{{ vault_smtp_port }}"
MM_EMAILSETTINGS_ENABLESMTPAUTH: "false"
MM_EMAILSETTINGS_SMTPUSERNAME: "{{ vault_smtp_user }}"
MM_EMAILSETTINGS_SMTPPASSWORD: "{{ vault_smtp_password }}"
MM_EMAILSETTINGS_CONNECTIONSECURITY: "{{ vault_smtp_protocol }}"
MM_SERVICESETTINGS_ENABLESECURITYFIXALERT: "true"
generate_systemd:
path: /home/containers/.config/systemd/user/
restart_policy: on-failure
requires: [container-db_mattermost.service, container-traefik.service]
names: true
new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-mattermost.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-db_mattermost.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
enabled: true
state: started
daemon_reload: true
loop:
- mattermost
- db_mattermost

View File

@@ -1,6 +1,7 @@
[Unit] [Unit]
Description=Nextcloud cron.php job Description=Nextcloud cron.php job
Wants=nextcloudcron.timer Wants=nextcloudcron.timer
Requires=container-nextcloud.service
[Service] [Service]
ExecStart=/bin/podman exec -u www-data nextcloud php -f /var/www/html/cron.php ExecStart=/bin/podman exec -u www-data nextcloud php -f /var/www/html/cron.php

View File

@@ -15,6 +15,7 @@
- nextcloud - nextcloud
- redis_nextcloud - redis_nextcloud
- db_nextcloud - db_nextcloud
failed_when: false
- name: Pull container images - name: Pull container images
become_user: containers become_user: containers
@@ -47,7 +48,7 @@
path: /etc/nextcloud path: /etc/nextcloud
owner: containers owner: containers
group: containers group: containers
mode: 0700 mode: "0700"
state: directory state: directory
- name: Copy nextcloud config directory - name: Copy nextcloud config directory
@@ -57,7 +58,7 @@
dest: /etc/nextcloud/config/ dest: /etc/nextcloud/config/
owner: containers owner: containers
group: containers group: containers
mode: 0600 mode: "0600"
- name: Copy systemd service and timer - name: Copy systemd service and timer
become: true become: true
@@ -67,7 +68,7 @@
dest: "/home/containers/.config/systemd/user/" dest: "/home/containers/.config/systemd/user/"
owner: containers owner: containers
group: containers group: containers
mode: 0644 mode: "0644"
- name: Copy mariadb config directory - name: Copy mariadb config directory
become: true become: true
@@ -76,7 +77,7 @@
dest: /etc/nextcloud/mariadb/ dest: /etc/nextcloud/mariadb/
owner: containers owner: containers
group: containers group: containers
mode: 0600 mode: "0600"
- name: Create podman networks - name: Create podman networks
containers.podman.podman_network: containers.podman.podman_network:
@@ -105,7 +106,6 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600
names: true names: true
new: true new: true
@@ -133,7 +133,6 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600
names: true names: true
new: true new: true
@@ -184,8 +183,8 @@
SMTP_SECURE: "{{ vault_smtp_protocol }}" SMTP_SECURE: "{{ vault_smtp_protocol }}"
SMTP_PORT: "{{ vault_smtp_port }}" SMTP_PORT: "{{ vault_smtp_port }}"
SMTP_AUTHTYPE: "None" SMTP_AUTHTYPE: "None"
SMTP_NAME: "" SMTP_NAME: "{{ vault_smtp_auth_name }}"
SMTP_PASSWORD: "" SMTP_PASSWORD: "{{ vault_smtp_password }}"
MAIL_FROM_ADDRESS: "{{ vault_smtp_from }}" MAIL_FROM_ADDRESS: "{{ vault_smtp_from }}"
MAIL_DOMAIN: "{{ vault_smtp_domain }}" MAIL_DOMAIN: "{{ vault_smtp_domain }}"
TRUSTED_PROXIES: "traefik" TRUSTED_PROXIES: "traefik"
@@ -195,11 +194,42 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
requires: [container-db_nextcloud, container-redis_nextcloud] requires: [container-db_nextcloud.service, container-redis_nextcloud.service, container-traefik.service]
time: 3600
names: true names: true
new: true new: true
- name: Change start timeout limit
become_user: containers
become: true
community.general.ini_file:
path: "/home/containers/.config/systemd/user/container-{{ item }}.service"
section: Service
option: TimeoutStartSec
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- nextcloud
- redis_nextcloud
- db_nextcloud
- name: Change stop timeout limit
become_user: containers
become: true
community.general.ini_file:
path: "/home/containers/.config/systemd/user/container-{{ item }}.service"
section: Service
option: TimeoutStopSec
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- nextcloud
- redis_nextcloud
- db_nextcloud
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -18,6 +18,7 @@
state: stopped state: stopped
loop: loop:
- portainer - portainer
failed_when: false
- name: Pull portainer image - name: Pull portainer image
become_user: containers become_user: containers
@@ -69,10 +70,25 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600 requires: [container-traefik.service]
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-portainer.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -18,6 +18,7 @@
state: stopped state: stopped
loop: loop:
- traefik - traefik
failed_when: false
- name: Permit traffic from any IP to http port - name: Permit traffic from any IP to http port
become: true become: true
@@ -37,6 +38,15 @@
to_port: 443 to_port: 443
rule: allow rule: allow
- name: Permit traffic from any IP to mattermost port
become: true
community.general.ufw:
direction: in
from_ip: any
proto: udp
to_port: 8443
rule: allow
- name: Pull traefik image - name: Pull traefik image
become_user: containers become_user: containers
become: true become: true
@@ -49,7 +59,7 @@
path: /etc/traefik path: /etc/traefik
owner: containers owner: containers
group: containers group: containers
mode: 0700 mode: "0700"
state: directory state: directory
- name: Copy config directory - name: Copy config directory
@@ -59,7 +69,7 @@
dest: /etc/traefik/ dest: /etc/traefik/
owner: containers owner: containers
group: containers group: containers
mode: 0600 mode: "0600"
- name: Copy config files from templates - name: Copy config files from templates
become: true become: true
@@ -68,7 +78,7 @@
dest: "/etc/traefik/{{ item }}" dest: "/etc/traefik/{{ item }}"
owner: containers owner: containers
group: containers group: containers
mode: 0600 mode: "0600"
loop: loop:
- traefik.yml - traefik.yml
- conf/cockpit.yml - conf/cockpit.yml
@@ -87,6 +97,7 @@
- traefik-gitea - traefik-gitea
- traefik-collabora - traefik-collabora
- traefik-heimdall - traefik-heimdall
- traefik-mattermost
- name: Create traefik instance - name: Create traefik instance
become_user: containers become_user: containers
@@ -98,6 +109,7 @@
publish: publish:
- "80:80" - "80:80"
- "443:443" - "443:443"
- "8443:8443"
security_opt: security_opt:
- label=type:container_runtime_t - label=type:container_runtime_t
volume: volume:
@@ -110,6 +122,7 @@
- traefik-gitea - traefik-gitea
- traefik-collabora - traefik-collabora
- traefik-heimdall - traefik-heimdall
- traefik-mattermost
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
label: label:
@@ -117,7 +130,7 @@
traefik.enable: "true" traefik.enable: "true"
traefik.http.middlewares.traefik-auth.basicauth.users: "{{ vault_traefik_basic_auth }}" traefik.http.middlewares.traefik-auth.basicauth.users: "{{ vault_traefik_basic_auth }}"
traefik.http.routers.traefik.entrypoints: "https" traefik.http.routers.traefik.entrypoints: "https"
traefik.http.routers.traefik.rule: "Host(`{{ vault_domain }}`) && PathPrefix(`/api`,`/dashboard`)" traefik.http.routers.traefik.rule: "Host(`{{ vault_domain }}`) && (PathPrefix(`/api/`) || Path(`/api`) || PathPrefix(`/dashboard/`) || Path(`/dashboard`))"
traefik.http.routers.traefik.middlewares: "traefik-auth@docker" traefik.http.routers.traefik.middlewares: "traefik-auth@docker"
traefik.http.routers.traefik.tls: "true" traefik.http.routers.traefik.tls: "true"
traefik.http.routers.traefik.tls.certresolver: "wildcard" traefik.http.routers.traefik.tls.certresolver: "wildcard"
@@ -126,10 +139,24 @@
generate_systemd: generate_systemd:
path: /home/containers/.config/systemd/user/ path: /home/containers/.config/systemd/user/
restart_policy: on-failure restart_policy: on-failure
time: 3600
names: true names: true
new: true new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-traefik.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot - name: Start containers at boot
become_user: containers become_user: containers
become: true become: true

View File

@@ -21,6 +21,8 @@ entryPoints:
permanent: true permanent: true
https: https:
address: ":443" address: ":443"
mmcalls:
address: ":8443/udp"
providers: providers:
docker: docker:

View File

@@ -0,0 +1,154 @@
---
- name: Online project management tool
hosts: all
tasks:
- name: Stop running containers
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
state: stopped
loop:
- vikunja
- db_vikunja
failed_when: false
- name: Pull container images
become_user: containers
become: true
containers.podman.podman_image:
name: docker.io/{{ item }}
loop:
- vikunja/vikunja:latest
- mariadb:latest
- name: Create podman volumes
containers.podman.podman_volume:
state: present
name: "{{ item }}"
become_user: containers
become: true
loop:
- vikunja-data
- vikunja-db
- name: Create podman networks
containers.podman.podman_network:
name: "{{ item }}"
recreate: false
state: present
become_user: containers
become: true
loop:
- traefik-vikunja
- mariadb-vikunja
- name: Create mariadb instance
become_user: containers
become: true
containers.podman.podman_container:
name: db_vikunja
image: docker.io/mariadb:latest
state: present
volume:
- vikunja-db:/var/lib/mysql:Z
network:
- mariadb-vikunja
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --max-connections=1000
env:
MARIADB_ROOT_PASSWORD: "{{ vault_vikunja_mariadb_root_password }}"
MARIADB_DATABASE: "{{ vault_vikunja_mariadb_database }}"
MARIADB_USER: "{{ vault_vikunja_mariadb_user }}"
MARIADB_PASSWORD: "{{ vault_vikunja_mariadb_password }}"
MARIADB_AUTO_UPGRADE: "true"
healthcheck: "mysqladmin ping --silent"
healthcheck_interval: 2s
generate_systemd:
path: /home/containers/.config/systemd/user/
restart_policy: on-failure
names: true
new: true
- name: Create vikunja instance
become_user: containers
become: true
containers.podman.podman_container:
name: vikunja
image: docker.io/vikunja/vikunja:latest
state: present
volume:
- vikunja-data:/app/vikunja/files:Z
network:
- traefik-vikunja
- mariadb-vikunja
env:
VIKUNJA_DATABASE_HOST: db_vikunja
VIKUNJA_DATABASE_PASSWORD: "{{ vault_vikunja_mariadb_password }}"
VIKUNJA_DATABASE_TYPE: mysql
VIKUNJA_DATABASE_USER: "{{ vault_vikunja_mariadb_user }}"
VIKUNJA_DATABASE_DATABASE: "{{ vault_vikunja_mariadb_database }}"
VIKUNJA_SERVICE_JWTSECRET: "{{ vault_vikunja_jwt_secret }}"
VIKUNJA_SERVICE_PUBLICURL: https://{{ vault_domain }}/vikunja/
VIKUNJA_FRONTEND_BASE: /vikunja/
label:
io.containers.autoupdate: registry
traefik.enable: "true"
traefik.http.routers.vikunja.entrypoints: https
traefik.http.routers.vikunja.rule: Host(`{{ vault_domain }}`) && (PathPrefix(`/vikunja/`) || Path(`/vikunja`))
traefik.http.routers.vikunja.tls: "true"
traefik.http.routers.vikunja.tls.certresolver: wildcard
traefik.http.routers.vikunja.service: vikunja
traefik.http.services.vikunja.loadbalancer.server.port: "3456"
traefik.docker.network: traefik-vikunja
generate_systemd:
path: /home/containers/.config/systemd/user/
restart_policy: on-failure
names: true
new: true
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-vikunja.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Change start and stop timeout limits
become_user: containers
become: true
community.general.ini_file:
path: /home/containers/.config/systemd/user/container-db_vikunja.service
section: Service
option: "{{ item }}"
value: 3600
mode: "0664"
state: "present"
no_extra_spaces: true
loop:
- TimeoutStartSec
- TimeoutStopSec
- name: Start containers at boot
become_user: containers
become: true
ansible.builtin.systemd:
scope: user
name: container-{{ item }}.service
enabled: true
state: started
daemon_reload: true
loop:
- db_vikunja
- vikunja

View File

@@ -1,86 +1,106 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
30663733363338333134613333316434633861386238613634303762653635326631353737323330 63626565393066343966323064646661383330623937613233616534313331363530613062643964
6466356331313639613666616631633036376339343236660a323631613662313162316537366136 3831383231313564376432303465376532623531643539610a663134386361353330626637626162
62653630643732643735363136356230356333363232663632373730653264643563343061303930 64373334373639663762343362646636303837376138393338643533363438616535623064323061
6530366261643938320a353264663234346465356666333233643533303962303134393331373137 6436343866336234350a313733383930366635646437383464353363643964346437323535333866
64316365363035346435613734656338333161613066393863363531646230346233633430623239 39636163666637326531336136653461636135363230663762613637666230353135616435393962
61353437386434393135376234356464313533303861663662376434333838616437623132353438 32383132313963623131313831326333656232656538336433633735633939636661383266396663
63333365353837313738313464306431313137356634323563356234356630316166303030313765 30653763333761623734383862326438626631643965376137663662643362663165306265633363
61333134346237323261626662383833616236366132353333373532373130376332303664353164 63636238336438643733633665613232306437396130663432366364613737653431653361653965
62363735613933626338376666353364366239353466646434373961623666663033363630306663 32373931633536656335396134313065666437666634343466653136343362343165366233383964
32623132363836666365306161646631386631633966363034303932303361333834313931363034 66663263316162626466646234623363616135663039393761373734663566623235343263323261
36643364353363323331643735636363323132336438383765363937356239666662336330653330 37646434373863303033386464343766323462643338396466363863356430616431343463326432
32653364316363626636386232353334343337643163383435303339313937613965313963646666 66376630663337386461663934393566393138353363376235343764363431323636653361343839
30356465653162336638313439613965316630656661333061663033643033653564353635386233 33353864653031633831383639633565616332373033333436636362393565306233326632373639
38656636313137333464636431646239376661343833333239646161613838333131363031396233 38316265303135366436643262653733663333383863386536343035366362643762646437306135
65326431323763336334613262363162643335656265326364383237386561366434656630666533 65663065366335656436633137316266643361643336613235613562633537313366343163376164
63623037316264373865616230623465333638306561633332663366363461613935653462623863 63663661383032343962666363393834626339333437313032303134643036646636333464353931
63346432383336333664346333623366323031316137313139303738306135636136346664376232 66356664623938333230616365316666653832393730616332376434336339363430366239656636
65633030373838643363333839303432306632623437646331623336386264393439376139343464 31323236666165623736376133393063323537326164386536633631313466653162663739376639
64346330623530663531653031316561646534663762653739363064353962386538666138323635 35376364653066396635396539316234313037356339363833396430353134356136666537363337
66663639646264623765363763663030393564396335653864343061343036623135376463663565 63343435363235386538636361343138363263663035653666656637333036666331343139373463
39343839333635636434336239353536363130396337633065643039316233666436623464633166 61666266636134366233633766623430633164636337653839663365343062616464323861363836
64626461656634353239343239326130303935303663303464336633643961396664386265653339 64613638626338353335633164613931363537356232373066323035393435373932633932663838
31343236376364316566363437653765373236653463623132626530626363373364353633376131 62303232643835303636323638653435343836383432313161306363303565356239663430376331
37623831323334323439313563653734376361363361373431653862343561323133346532646161 62323038616332663032366133656632663363623837333537366432643439353934346165623039
62633239363736643531623338353930396261303836646137393333373466363963336265656166 63306436653235646535333134643438656133323131333266656337396337353833313230653438
37373631323836343833333263303037356435333961356466343438666663373965663563646533 66313834656430323962653263643231396330313561613935336132646238366637633230323134
64366163366534333739366466656265326234333137313933663363653161393062363336393466 35346564383166636563366637643738353838636530303235616265306133336431393064646434
30616635313737346133663163366331333161303163346239653266353862343564326434373935 32363065633136326364336637656235316330323137633364383739633032366437373233376334
37626533646331346263333737633330373364396433323634313365343463373539626665343463 38663762643832373264383064333662376634633738383239343932353162343466393637343439
39323635323161396238323439316334333362376561636565333939303562396534376337303662 31353936366137623538393737316661666161633464343466306139323030653935343564396132
37373832386337326430386531623163353265303763363561353035653562666532316261323662 66653934326230326563643837333562333438303334623138623362323737313461373930666162
33303536326437653065343464373261303062633930336564626539333163626530333363643033 34656162313730663365373835366231383638623834653238326261616332333665393732383864
36383839386531613031383835623239366235393233373263373635656532646362343639356333 31646163346431373434323961633966623564363432306562663031626562353036613632666130
62663934646237646134376238653265663539383039346138623065386564366138333461653639 31656466333934663265656336313161643135346235663838383563333535623163396636613738
38363366386534663430636436613836383230663063326665636237656366376366653833396437 34376534386635393062306363343137336666656330343863623439316131353066353337383734
66653162316138363037346165313235633935353038333465623238373337626134663531313135 35306137353434333435313033636565653537306264636332646464306633666635616435663034
33666533396238306232366666666433653537643431363733643261663363336339633538386561 38653635383861343237616339306662663634653937663730376232306161306435333432343235
64356161663737663566636361663038343331636437373462336665316337666232393135663563 38626232613939623166623465353837663064396264643966383634343736353161346232373135
64323032343337626633356236356538366432643734383037336666366630633162386335363764 66303338376338663431373131653462343766376235653762343564383965333131353431356565
34383035636639316362313962353439373062616165323163313963616464393866353638643930 66313163343537343931306131373738383965356433323139333262363331663438316364343539
63633434366165306662383436643039653263386430623831623230616331333433346262636165 32373362613433633638306235383638313334633130326637613734393965633164646539396465
62333863653634343530326335656666373731303236653636663739313031363334333038393662 30356135666464353531643061346635386663366438656638646237366431366237616632363330
38616435646461646438303865666230636561643635626636393465313133646565356362643761 38646661396561643039336631333037313638653334666361383132323264323037633132353464
62303565666132626534653734666237633762386266613330663237323631333562663232373731 61306261353765386136313331623264633532363833343336313465333332663837303934313332
33353861313238363165626337363939376563343465306364373137623231313062633838303161 63633330313434353666616533663939383431303334616434303037643763383935633061643737
66333038306666363030326566613966303036636563633862333738346233336335363238343966 37376139656565633466633638303838623238363030363734323739643339633130633030346431
31656634376436366135643731663939353332633566323437653163323931393334633937656131 39373863376137376430313532623662633738666539663566316366356536613963323437636236
34363133623865613061303338373038663165656230643030663037313934343231313233636236 36396461646439326164623230303362636664303131326561383536653436316239643161313932
65623865623137333732303536393265353363393630343837656666616234393037316136343038 36393638666630383761303965666461326433393635306230333136343064633161373034656635
39326466363836643937656163306661396239333665303133363133613066613034386162633361 35386362316465366134386566656366616236326133366665366437616630346565353261613464
63353731393861396337313266633564396462393364643831333235366433303764303266613163 31633338623163626138663034346137356131333335333536386365373237333737653163333533
30646630363862303965376636346133316135666535643135393935326138346162336436626533 39373430633534636632356432313161636433393931303361366565353665633662313832646565
62346661333263636363313134336435323330646262303934346138663131333631326234353263 35633237663161313832613065326638356130306439643437613735643264373331653331373232
38643165646131656639363235366530353366353464343361656536373639653238366438643335 33383966363833376439333431303664323465383664383566656531663366383735383364663461
36376331316264333263613037636263386630306430623437383061383631366662633435643337 66623161623738343365356365303730656337373636333361376534356363366134333338366464
37336236336164303839386536333630343363373066373534626330653532313335383863623866 34366139636162613031313265306635663435396533633031316139356163613532363737313031
62376438616162343832613365333765306462636535346330373230333634383263323961363563 37393438653465323963343139383766373062666632343939316166646265393730343331386630
62326363383464353536643035653966643239306338346238393838323363643134373363613231 64616231386330386339656434346236376432376432383639363431666233336437623263663763
63653063333931303739623935626531376433333766666562633837623431313031653163373731 31363964313766386535646561656261633938656238303762633465373565633962626663336266
39363238643064366133626662326335656331646238366565316463663265393630653839656331 66313965613730643631376264343461633038616430326637633330313861363233363162623232
62323865346565323030396261316566656265346331316261393861303634363266323435303930 66363861383530373933326436373165383930316138633665663336663266626362386365653264
37633765626637653666623663366664333837336166333464313865383234643531363438393837 33376230376336393962313036393134316233316539393037323065643265633964306530656462
35656363396265666633316533376337323733363737633264326230663161623365653033376431 30383562653333323263613661393861643332656330633635333135616463336566353630666562
38323332383635313339356339396535396263343036343861633530313537643766633432373336 31646139326630343738653539373337356139653338306663353932623535626232636634393334
65316161316232326432623363633365326265653531613532396438623961326632636235396661 66323230393633646165633835653834373261353031356365643933303737313534383533663762
37343939663837323864326237393632343537366166346537666136303961373436626663326463 32643739646639656430663562393166626539353533656563393862353562336432373234656136
37376230646565343739376438633335613062633061333239326332656666623031393135376139 35343266356330306432346435363035336432636135663464393033353733393732356364613132
66373665383935353830666535343965333637356561653066346364656665383134613931356261 65353464616231653137373734323761396430363664643464353430646134656665633933623666
63623432353532373462613365326165643130393662366462303631396464306265363837306463 62363535303265353533333335653061616230613163373361363336373337623131383563323938
37373262623864333833383463346233326130323662313763623861323430306163383538623331 66643830363863616134343564343132346639323030396166383965336265396138636431666462
66366566626135623838656163373932386234333361383133623031663434373732356366303930 62306333363136653462386633643637663262623638373833663030316539623566323461393536
30316662663534333765366531313162336361623065363061396135343837633962613165666435 36656465353436336363623536376164373264643863666631353865643462663636636130376266
34653435353635653061656665363261613430623766333564343030326438343334363562373364 32623435643631303836653262643031353630396261343666663237663436366664356639366532
36653034653631643566666562383663303434383238633033316330386664373764626330363837 34353839373863646366366236623265346631343561666263346136326534353634613638336339
32313330373138386362366364326665373538613737343563343130623365373065363337353834 36356131633464343565626539653738396334653564303563306131316539343438636265663736
35323935346466313564346261316633616133396532356131346635343038323434336535316633 30306134333431366530666131616265336637396237626436326462363062313861633565346264
35613666323234633962313063333861643466643336386161623335386136663137643632623461 34613432343938636232316466396565323038613931616361643561613862333638636163623532
30356665343234353061633163656230636233303634326663643336623739326639643735343237 65393137636636303830376535396238336433626266313136616135323937303033396230303265
30633265386239306462643134323164393032363663353738633464313362666563303539326636 34666461356339373061626434613366303664636337373362326237633834366263393938663963
61373738663932353137303639326435363062346234656561313039636365373133313331363634 35363565643330313839653935393336663338316635636333353963333334616661393065373935
33336466373436663030623039306130346464356563303461633731316637336464353164356331 36366265653835343363636237356433366164636664346633393239316539383565663561316136
32323764396431343763666363653430353232633563383436393533613234346237323735396435 39623162363961623239346132623933303864373664343333393466343564393762646365346562
62666233366436333461626561613666643930626130623037643332386263366431376638623030 65646563343865323261366335663765373364336266376431373536656366343539656466363939
31646538643130623261303662393338396338653939343066633863653439643263303364303334 33303732383034346465633838623864623130653334666436623837636234356361663562306666
3666 31316166656638613137636435383733363365346230626130633564386433623931396264383265
62396435376634383863663136343731386536326461643932303263656636656139316661613134
33663666636664306539313537616261363933653037616364643637396234646431356262653566
34336534306632373034623534363765376538323333386137626638363430633538353030343137
66353235353731646333623562363065333533323734373765383562633337323962306430353635
37333664643636643037393638316537386164613136393732653061616134316534383365303839
33383731616365613031646534343733363037366235383131643564366239626563633132306163
31306335323664303634333432666230626462393261393761646434616233666436326432373466
32306164373936363937316530313564313262343164366539396135353639666138616364636239
34306432653335653837383134623665663062663339633263366131633836326137333932313730
38336638626262636535306235383437316333646362383265623931616235363034666231656239
39396337633932356335386365313066363863376166303335396364376638303430336436323038
63666361636630393562316465346334393963356130353564633437663731656234643264386137
37386237646261656364643031326166313539663938363532643131633332306331623538353036
35356136356234616330613636356137393665303065653763386563303938373162656438373333
65393262613338363661646532306435343334343035363034636131366264373436633436333366
33303531326433643866653961643839336464613036623961353661313534396334313533633963
30386337653237386466383531623936306666326633393239353533396663393032626331323365
33353433663663303331353633353634333164393065336231633930656335666538663464353837
35353262623637303731303932356432313337643139383264336230383331323966393261376539
3133

View File

@@ -28,7 +28,7 @@
dest: /etc/cockpit/cockpit.conf dest: /etc/cockpit/cockpit.conf
owner: root owner: root
group: root group: root
mode: 0644 mode: "0644"
# https://cockpit-project.org/faq.html#error-message-about-being-offline # https://cockpit-project.org/faq.html#error-message-about-being-offline
- name: Allow NetworkManager to manage network interfaces - name: Allow NetworkManager to manage network interfaces

View File

@@ -65,6 +65,7 @@
state: started state: started
- name: Enable podman auto-update timer - name: Enable podman auto-update timer
become_user: containers
become: true become: true
ansible.builtin.systemd: ansible.builtin.systemd:
name: podman-auto-update.timer name: podman-auto-update.timer
@@ -76,7 +77,7 @@
remote_src: true remote_src: true
src: /usr/share/containers/containers.conf src: /usr/share/containers/containers.conf
dest: /etc/containers/containers.conf dest: /etc/containers/containers.conf
mode: 0644 mode: "0644"
- name: Set podman default subnet into small /24 networks - name: Set podman default subnet into small /24 networks
become: true become: true