Ansible Role podman_containers
This role installs Podman and deploys Quadlets to configure containers, networks and volumes. The role supports running rootless containers.
Mandatory Requirements
- When running rootless containers, make sure to create a user with lingering enabled. This can be done using the linuxfabrik.lfops.login role: 
login__users__host_var:
  - name: 'example'
    home: '/opt/example'
    state: 'present'
    linger: true
Optional Role Variables
| Variable | Description | Default Value | 
|---|---|---|
| 
 | List of dictionaries describing the Podman containers. Subkeys: 
 | 
 | 
| 
 | List of dictionaries describing the Podman networks. Subkeys: 
 | 
 | 
| 
 | List of dictionaries describing the Podman volumes. Subkeys: 
 | 
 | 
Example:
# optional
podman_containers__containers__host_var:
  - name: 'rocketchat'
    raw_container: |
      AutoUpdate=registry
      ContainerName=rocketchat
      EnvironmentFile=/opt/rocketchat/rocketchat.env
      HealthCmd=curl --fail --show-error --silent --max-time 2 http://localhost:3000
      HealthInterval=30s
      HealthOnFailure=kill
      HealthRetries=5
      HealthStartPeriod=5s
      HealthTimeout=10s
      Image=registry.rocket.chat/rocketchat/rocket.chat:latest
      LogDriver=journald
      Network=rocketchat.network
      PublishPort=3000:3000/tcp
      User=rocketchat
      UserNS=keep-id:uid=1000,gid=1000
    raw_service: |
      Restart=always
    user: 'rocketuser'
podman_containers__networks__host_var:
  - name: 'rocketchat'
    user: 'rocketuser'
podman_containers__volumes__host_var:
  - name: 'rocketchat'
    user: 'rocketuser'
Troubleshooting
Failed to enable unit: Unit ... is transient or generated.: Since the units are generated, systemctl enable/disable has no effect. Autostarting is handled by the podman-system-generator based on the WantedBy setting in the quadlet. Have a look at man podman-systemd.unit for details.