ansible-role-podman-quadlet.../README.md
z3r0 2485e43ca4
All checks were successful
ci/woodpecker/push/release Pipeline was successful
docs: update README.md
2026-05-02 13:01:36 +02:00

89 lines
3.3 KiB
Markdown

Podman Quadlet Service Ansible role
=========
An Ansible role to deploy Quadlet-based Podman services.
Role Variables
--------------
service_name: "generic-service"
The name of the service to deploy.
containers: []
A list of Podman container definitions. Each container definition should receive the same parameters that are described at [containers.podman.podman_container module](https://docs.ansible.com/projects/ansible/latest/collections/containers/podman/podman_container_module.html#ansible-collections-containers-podman-podman-container-module).
create_network: false
Set to `true` to create a dedicated a Podman network for this service. The network's name will be the same as `service_name`.
create_pod: false
Set the value to `true` to create a pod for this service. All the containers defined in `containers` will belong to this pod. The name of the pod will be the same as `service_name`.
network: {}
A Podman network definition. It should receive the same parameters that are described at [containers.podman.podman_network_module](https://docs.ansible.com/projects/ansible/latest/collections/containers/podman/podman_network_module.html#ansible-collections-containers-podman-podman-network-module). The name of the network will be the same as `service_name`.
pod: {}
A podman pod definition. It should receive the same parameters that are described at [containers.podman.podman_pod module](https://docs.ansible.com/projects/ansible/latest/collections/containers/podman/podman_pod_module.html#ansible-collections-containers-podman-podman-pod-module). The name of the pod will be the same as `service_name`.
secrets: []
A list of Podman secret definitions. Each secret definition should receive the same parameters that are described at [containers.podman.podman_secret module](https://docs.ansible.com/projects/ansible/latest/collections/containers/podman/podman_secret_module.html#ansible-collections-containers-podman-podman-secret-module).
service_user: "root"
The name of the user that will execute the service. If the user is not `root` the service will run in rootless mode. See the [rootless tutorial](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md) for more info about running containers in rootless mode.
Example playbook
----------------
```yaml
- name: Playbook
hosts: webservers
roles:
- role: ansible-role-podman-quadlet-service
vars:
service_name: nginx
create_network: true
create_pod: false
containers:
- name: nginx
image: nginx:latest
env:
ENV_VAR: "value"
secrets:
- my-secret,type=env,target=SECRET_ENV_VAR
userns: "keep-id:uid=1000,gid=1000"
volumes:
- "%h/logs:/var/log/nginx"
ports:
- "80:80"
quadlet_filename: nginx-app
quadlet_file_mode: "600"
quadlet_options:
- |
[Service]
Restart=always
- |
[Install]
WantedBy=default.target
secrets:
- name: my-secret
data: "super-secret-value"
```
License
-------
GPLv3
Author Information
------------------
Created with ❤️ by [z3r0](https://gts.maverick-hq.org/@z3r0).