Skip to content

Commit

Permalink
New podman::manage_container type for container unit
Browse files Browse the repository at this point in the history
Assuming at least podman 4.4.0 the new type `podman::mange_container`
will create a quadlet unit file a container which will inturn
generate a service unit for managing the container.

Currently only a tiny subset of a container unit is possible and
only a root container can be run.

The included examples are operational however.

This can be extended later to support a fuller container description
as well rootless containers and also units for pods, networks and
volumes.
  • Loading branch information
traylenator committed Feb 27, 2024
1 parent fb3ce01 commit fc7e540
Show file tree
Hide file tree
Showing 9 changed files with 591 additions and 184 deletions.
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
---
fixtures:
forge_modules:
systemd: "puppet/systemd"
stdlib: "puppetlabs/stdlib"
concat: "puppetlabs/concat"
selinux_core: "puppetlabs/selinux_core"
Expand Down
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,34 @@ Several additional examples are in a separate [github project](https://github.co
a Traefik container configuration that enables SSL termination and proxy access to other containers running on the host, with a dynamic
configuration directory enabling updates to proxy rules as new containers are added and/or removed.

## Creating Containers with Unit Files

Container unit files can be created and managed, for example:

```puppet
podman::manage_container{'centos.container':
ensure => present,
unit_entry => {
'Description' => 'Trivial Container that will be very lazy',
},
service_entry => {
'TimeoutStartSec' => '900',
},
container_entry => {
'Image' => 'quay.io/centos/centos:latest',
'Exec' => 'sh -c "sleep inf'
},
install_entry => {
'WantedBy' => 'default.target'
},
active => true,
}
```

Will create a service `centos.service` that is then started and eanbled for boot.


## Limitations

The module was written and tested with RedHat/CentOS, but should work with any distribution that uses systemd and includes
Expand Down
Loading

0 comments on commit fc7e540

Please sign in to comment.