Initial commit
Basic roles for installing podman, creating containers, networks and services
This commit is contained in:
46
roles/container/templates/container.j2
Normal file
46
roles/container/templates/container.j2
Normal file
@@ -0,0 +1,46 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Container {{ container_name }}
|
||||
{% for requirement in container_requires %}
|
||||
Requires={{ requirement }}
|
||||
After={{ requirement }}
|
||||
{% endfor %}
|
||||
{% for want in container_wants %}
|
||||
Requires={{ want }}
|
||||
Before={{ want }}
|
||||
{% endfor %}
|
||||
|
||||
[Container]
|
||||
Image={{ container_image }}
|
||||
ContainerName={{ container_name }}
|
||||
{% if container_command | length > 0 %}
|
||||
Exec="{{ container_command | join('" "') }}"
|
||||
{% endif %}
|
||||
{% if container_user | length > 0 %}
|
||||
User={{ container_user }}
|
||||
{% endif %}
|
||||
{% for mount in container_mounts %}
|
||||
Mount={% for key, value in mount.items() %}{{ key }}={{ value }}{% if not loop.last %},{% endif %}{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
{% for network in container_networks %}
|
||||
Network={{ network }}.network
|
||||
{% endfor %}
|
||||
{% for port in container_publish_ports %}
|
||||
PublishPort={{ port }}
|
||||
{% endfor %}
|
||||
{% for key, value in container_env.items() %}
|
||||
Environment={{ key }}={{ value }}
|
||||
{% endfor %}
|
||||
{% if container_auto_update %}
|
||||
AutoUpdate=registry
|
||||
{% endif %}
|
||||
|
||||
{% if container_auto_start %}
|
||||
[Service]
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user