Files
johto-infra/roles/minecraft_server/tasks/main.yaml
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

28 lines
765 B
YAML

---
- name: Create Minecraft Directories
ansible.builtin.file:
path: "{{ podman_config_base_dir }}/mc-{{ item.name }}/data"
state: directory
mode: "0755"
loop: "{{ minecraft_servers }}"
- name: Create Minecraft Quadlets
ansible.builtin.template:
src: minecraft.container.j2
dest: "{{ podman_quadlet_base_dir }}/services/mc-{{ item.name }}.container"
owner: "{{ ansible_user }}"
mode: "644"
loop: "{{ minecraft_servers }}"
register: minecraft_quadlet_results
notify: Restart changed Minecraft Services
- name: Flush Handlers
ansible.builtin.meta: flush_handlers
- name: Start Minecraft Servers
ansible.builtin.systemd:
name: "mc-{{ item.name }}"
state: started
scope: user
loop: "{{ minecraft_servers }}"