### Description This PR adds new `minecraft_server` to configure and start a Minecraft server container on targeted hosts. ### Related Issue Closes #18 ### Testing Done - [x] Verifed new role creates container files correctly - [x] verified new container is able to start and run via systemd - [x] verified server is accessible via Minecraft client ### Checklist - [x] My code follows the project's style guidelines. - [x] I have performed a self-review of my own code. - [x] I have updated the documentation (if necessary). --------- Co-authored-by: Jordan Del Pilar <[email protected]> Reviewed-on: #19
41 lines
839 B
Django/Jinja
41 lines
839 B
Django/Jinja
# {{ ansible_managed }}
|
|
[Unit]
|
|
After=network-online.target
|
|
|
|
StartLimitBurst=10
|
|
StartLimitIntervalSec=120
|
|
|
|
[Container]
|
|
ContainerName=mc-{{ item.name }}
|
|
Image={{ item.image }}
|
|
|
|
Network=management-net
|
|
PublishPort={{ item.port | default(mc_port) }}:25565
|
|
|
|
AutoUpdate=registry
|
|
|
|
Label=category=management
|
|
Label=owner={{ item.container_owner | default('jdelpilar') }}
|
|
|
|
Volume={{ podman_config_base_dir }}/mc-{{ item.name }}/data:/data
|
|
{% if item.volumes is defined %}
|
|
{% for volume in item.volumes %}
|
|
Volume={{ volume }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
Environment=TZ={{ timezone | default('America/Los_Angeles') }}
|
|
Environment=EULA=true
|
|
{% if item.env is defined %}
|
|
{% for key, value in item.env.items() | sort %}
|
|
Environment={{ key }}={{ value }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
|
|
[Service]
|
|
Restart=on-failure
|
|
RestartSec=5
|
|
|
|
[Install]
|
|
WantedBy=default.target
|