outwire.podman_systemd

Ansible Role for Podman Systemd

lint quality license

This role helps you set up Podman pods and containers as systemd services.

Role Variables

podman_systemd_service_path: /etc/systemd/system
podman_systemd_container_service_prefix: "container"
podman_systemd_pod_service_prefix: "pod"

This section defines where systemd service files will be stored. You can also change the prefix used for service names.

podman_systemd_default_wants: network.target
podman_systemd_default_after: network-online.target
podman_systemd_default_restart: on-failure
podman_systemd_default_wantedby: multi-user.target default.target

These are the default values for the systemd services. You can modify these settings for specific pods or containers (see below).

podman_systemd_default_container_detached: false

By default, containers start attached, allowing you to see the output in the syslog. If you want them to run detached, change this to true. This can also be set individually for each pod or container.

All other settings are located in defaults/main.yml

Important Notes

This role can run rootless containers or pods with a different user group (like using user "test" with group "asdf" instead of their own group). However, there may be issues with user IDs and group IDs in such cases.

Example for Container Variables

podman_containers:
  - name: nginx
    run_as_user: root
    run_args:
      -p 80:80
    image: nginx:latest
  - name: node-exporter
    run_as_user: prometheus
    run_args:
      -p 9100:9100
    image: quay.io/prometheus/node-exporter:v1.0.1

Example for Pod Variables

podman_pods:
  - name: nextcloud
    run_as_user: nextcloud
    run_user_subid: 500000:100000
    run_args:
      -p 8080:80
    restart: always
    containers:
      - name: db
        image: mariadb
        detached: true
        run_args:
          -v nextcloud-db:/var/lib/mysql
          -e MYSQL_ROOT_PASSWORD=rootpw
          -e MYSQL_PASSWORD=123
          -e MYSQL_DATABASE=nextcloud
          -e MYSQL_USER=nextcloud
        cmd_args:
          --transaction-isolation=READ-COMMITTED
          --binlog-format=ROW
      - name: app
        image: nextcloud
        run_args:
          -v nextcloud-app:/var/www/html
          -e MYSQL_ROOT_PASSWORD=rootpw
          -e MYSQL_PASSWORD=123
          -e MYSQL_DATABASE=nextcloud
          -e MYSQL_USER=nextcloud

License

MIT

Informazioni sul progetto

Configure podman pod and container systemd untis

Installa
ansible-galaxy install outwire.podman_systemd
Licenza
mit
Download
200
Proprietario