fix: leaner readmes
This commit is contained in:
+42
-92
@@ -1,114 +1,64 @@
|
||||
# Podman Role
|
||||
|
||||
This Ansible role installs and configures Podman for container management on NAS/homelab systems.
|
||||
Installs and configures Podman for container management with support for Docker Compose compatibility.
|
||||
|
||||
## Features
|
||||
|
||||
- Installs Podman and podman-compose
|
||||
- Configures container registry search paths
|
||||
- Creates shared projects directory for compose files
|
||||
- Enables short image name resolution (e.g., `redis:alpine` → `docker.io/library/redis:alpine`)
|
||||
- Creates external networks for services (e.g., dedicated Immich network)
|
||||
- Installs Podman, podman-compose, and crun (OCI runtime)
|
||||
- Configurable logging backend (journald or k8s-file)
|
||||
- External network creation for service isolation
|
||||
- Container registry search configuration
|
||||
- Shared projects directory for compose files
|
||||
|
||||
## Requirements
|
||||
## Container Logging
|
||||
|
||||
- systemd-based Linux distribution
|
||||
- Root/sudo access
|
||||
**journald (default):**
|
||||
- Logs sent to systemd journal
|
||||
- View: `journalctl CONTAINER_NAME=<name> -f`
|
||||
|
||||
## Role Variables
|
||||
**k8s-file:**
|
||||
- Logs stored as JSON files with automatic rotation
|
||||
- Configured via `podman_log_max_size` and `podman_log_max_files`
|
||||
|
||||
See `defaults/main.yml` for all available variables and their default values.
|
||||
Switch via `podman_log_driver` variable.
|
||||
|
||||
### Key Configuration
|
||||
## External Networks
|
||||
|
||||
#### Unqualified Search Registries
|
||||
|
||||
When you use short image names (without registry prefix), Podman searches configured registries in order (e.g., `redis:alpine` → `docker.io/library/redis:alpine`).
|
||||
|
||||
Customize via the `podman_unqualified_search_registries` variable.
|
||||
|
||||
|
||||
#### External Networks
|
||||
|
||||
The role can create external Podman networks for services that need dedicated network isolation. Define the `podman_external_networks` list in your inventory. Networks persist across container restarts and compose stack rebuilds. See `defaults/main.yml` for configuration details.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `containers.podman` collection (installed via `requirements.yml`)
|
||||
|
||||
## Example Playbook
|
||||
Define networks in inventory for persistent, isolated container networks:
|
||||
|
||||
```yaml
|
||||
---
|
||||
- hosts: servers
|
||||
become: true
|
||||
roles:
|
||||
- role: podman
|
||||
podman_external_networks:
|
||||
- name: immich
|
||||
subnet: 172.20.0.0/16
|
||||
gateway: 172.20.0.1
|
||||
```
|
||||
|
||||
### Custom Configuration
|
||||
Networks persist across container restarts and compose rebuilds.
|
||||
|
||||
See `defaults/main.yml` for all available variables. Override in your inventory as needed.
|
||||
|
||||
## Files Deployed
|
||||
|
||||
- `/etc/containers/registries.conf` - Registry configuration
|
||||
- `{{ podman_projects_dir }}` - Projects directory (default: `/opt/podman`)
|
||||
|
||||
## Usage
|
||||
|
||||
### Running Containers
|
||||
## Hands-on Commands
|
||||
|
||||
```bash
|
||||
# Using short names (works after role deployment)
|
||||
podman run -d redis:alpine
|
||||
# View container logs (journald)
|
||||
journalctl CONTAINER_NAME=immich_server -f
|
||||
|
||||
# Using fully qualified names (always works)
|
||||
podman run -d docker.io/library/redis:alpine
|
||||
# View container logs (k8s-file)
|
||||
podman logs -f immich_server
|
||||
|
||||
# Check log driver
|
||||
podman info --format '{{.Host.LogDriver}}'
|
||||
|
||||
# Inspect container log config
|
||||
podman inspect <container> | jq '.[0].HostConfig.LogConfig'
|
||||
|
||||
# Test configuration
|
||||
podman run --rm alpine echo "OK"
|
||||
|
||||
# List networks
|
||||
podman network ls
|
||||
```
|
||||
|
||||
### Docker Compose
|
||||
## References
|
||||
|
||||
Services using `podman-compose` should store their compose files in subdirectories:
|
||||
|
||||
```
|
||||
/opt/podman/
|
||||
├── immich/
|
||||
│ └── docker-compose.yml
|
||||
├── nextcloud/
|
||||
│ └── docker-compose.yml
|
||||
└── gitea/
|
||||
└── docker-compose.yml
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Short names not resolving
|
||||
|
||||
Check the registries configuration:
|
||||
```bash
|
||||
cat /etc/containers/registries.conf
|
||||
```
|
||||
|
||||
Test search order:
|
||||
```bash
|
||||
podman search redis --limit 3
|
||||
```
|
||||
|
||||
### Permission denied
|
||||
|
||||
Ensure the user is in the appropriate groups (handled by Podman package):
|
||||
```bash
|
||||
# Check groups
|
||||
groups $USER
|
||||
|
||||
# May need to log out and back in after installation
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Author Information
|
||||
|
||||
Created for managing containerized services in NAS/homelab environments.
|
||||
- [Podman Documentation](https://docs.podman.io/)
|
||||
- [Podman Logging](https://docs.podman.io/en/latest/markdown/podman-run.1.html#log-driver-driver)
|
||||
- [containers.conf(5)](https://github.com/containers/common/blob/main/docs/containers.conf.5.md)
|
||||
Reference in New Issue
Block a user