Files
johto-infra/roles/minecraft_server/templates/minecraft.container.j2
T
jdelpilarandJordan Del Pilar 857ec00b14
Johto Infrastructure Pipeline / Run Ansible Lint (push) Successful in 1m52s
Johto Infrastructure Pipeline / Deploy to Production (push) Successful in 3m9s
feat(minecraft): add new minecraft server role (#19)
### 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
2026-07-15 12:41:15 -07:00

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