Update functionality
This commit is contained in:
83
README.md
83
README.md
@@ -222,6 +222,89 @@ podman_pods:
|
||||
restart_policy: "always"
|
||||
```
|
||||
|
||||
### Systemd Service Generation
|
||||
|
||||
The role can automatically generate systemd service files for containers and pods. This functionality helps in managing container lifecycle through systemd.
|
||||
|
||||
* `podman_generate_systemd`: Enable systemd service generation (default: `true`)
|
||||
* `podman_systemd_dir`: Directory for generated service files (default: `/etc/systemd/system`)
|
||||
|
||||
**Global Systemd Options** (`podman_systemd_options`):
|
||||
|
||||
```yaml
|
||||
podman_systemd_options:
|
||||
new: true # Generate new service files
|
||||
force: true # Overwrite existing files
|
||||
restart_policy: unless-stopped # Default restart policy
|
||||
time: 120 # Stop timeout in seconds
|
||||
no_header: false # Include header in service files
|
||||
wants: [] # Systemd unit Wants
|
||||
after: [] # Systemd unit After
|
||||
requires: [] # Systemd unit Requires
|
||||
container_prefix: "" # Prefix for container service names
|
||||
pod_prefix: "" # Prefix for pod service names
|
||||
restart_sec: 30 # Restart delay in seconds
|
||||
```
|
||||
|
||||
**Per-Container/Pod Configuration:**
|
||||
|
||||
You can override global systemd options for individual containers or pods:
|
||||
|
||||
```yaml
|
||||
podman_containers:
|
||||
- name: webapp
|
||||
image: nginx:latest
|
||||
systemd:
|
||||
restart_policy: always
|
||||
after: ["network.target"]
|
||||
wants: ["network-online.target"]
|
||||
restart_sec: 10
|
||||
|
||||
podman_pods:
|
||||
- name: database
|
||||
systemd:
|
||||
restart_policy: on-failure
|
||||
requires: ["network.target"]
|
||||
time: 180
|
||||
```
|
||||
|
||||
When `systemd` is defined for a container or pod, the role will:
|
||||
1. Generate a systemd service file
|
||||
2. Place it in the specified directory
|
||||
3. Reload systemd daemon
|
||||
4. (Optional) Enable and start the service
|
||||
|
||||
**Note:** Container/pod-specific options take precedence over global options defined in `podman_systemd_options`.
|
||||
|
||||
### Resource Pruning
|
||||
|
||||
The role can automatically clean up unused Podman resources to free up disk space and maintain system hygiene.
|
||||
|
||||
* `podman_prune_enabled`: Enable automatic pruning of unused resources (default: `true`)
|
||||
* `podman_prune_options`: Configuration for what should be pruned
|
||||
|
||||
```yaml
|
||||
podman_prune_options:
|
||||
container: true # Remove stopped containers
|
||||
image: true # Remove unused images
|
||||
network: true # Remove unused networks
|
||||
system: true # Prune all unused data
|
||||
system_all: true # Prune all unused data including build cache
|
||||
volume: true # Remove unused volumes
|
||||
```
|
||||
|
||||
You can selectively disable certain types of pruning by setting their values to `false`:
|
||||
|
||||
```yaml
|
||||
podman_prune_options:
|
||||
container: true # Still remove containers
|
||||
image: false # Keep all images
|
||||
network: true # Remove unused networks
|
||||
system: false # Keep system data
|
||||
system_all: false # Keep build cache
|
||||
volume: false # Keep all volumes
|
||||
```
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user