ansible: retire Minecraft Fossils
The Fabric server holds 8.8 GB of asxpio-services' 15 GB of RAM, more than everything else on the host together, and the XMPP server moves here next. Save the world, remove its containers and the daily restart timer. The world stays in /opt/minecraft-fossils/data, and in the restic backups, until it is deleted by hand. Assisted-by: Claude:opus-5-5
This commit is contained in:
parent
59b5b4468a
commit
f2aa6375fd
7 changed files with 34 additions and 155 deletions
|
|
@ -1,49 +1,39 @@
|
|||
---
|
||||
# Fabric server plus a sidecar that mirrors the whitelist, ops and ban
|
||||
# lists from the Paper server. World data in /opt/minecraft-fossils/data
|
||||
# is not managed here. A compose change recreates the container, so it
|
||||
# is saved and stopped with time to finish first.
|
||||
- name: Deploy Minecraft Fossils
|
||||
ansible.builtin.include_role:
|
||||
name: docker_service
|
||||
vars:
|
||||
service_name: "minecraft-fossils"
|
||||
service_base_path: "{{ services_base_path }}/minecraft-fossils"
|
||||
service_templates:
|
||||
- src: "secrets.env.j2"
|
||||
dest: "secrets.env"
|
||||
owner: "{{ minecraft_fossils_owner }}"
|
||||
group: "{{ minecraft_fossils_owner }}"
|
||||
mode: "0600"
|
||||
service_files:
|
||||
- src: "docker-compose.yml"
|
||||
dest: "docker-compose.yml"
|
||||
owner: "{{ minecraft_fossils_owner }}"
|
||||
group: "{{ minecraft_fossils_owner }}"
|
||||
# secrets.env only matters at container start; never restart the
|
||||
# game server as a side effect of a deploy
|
||||
service_restart_on_change: false
|
||||
service_graceful_stop:
|
||||
- container: minecraft-fossils
|
||||
timeout: 120
|
||||
pre_stop: docker exec minecraft-fossils rcon-cli save-all flush
|
||||
health_check_enabled: false
|
||||
# Retired: the Fabric server is stopped for good to free its 8 GB of
|
||||
# RAM. The world stays in /opt/minecraft-fossils/data (and in the restic
|
||||
# backups) until it is deleted by hand.
|
||||
- name: Check for the old deployment
|
||||
ansible.builtin.stat:
|
||||
path: /opt/minecraft-fossils/docker-compose.yml
|
||||
register: fossils_compose
|
||||
|
||||
- name: Install the daily restart units
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "/etc/systemd/system/{{ item }}"
|
||||
mode: "0644"
|
||||
- name: Save the world
|
||||
ansible.builtin.command: docker exec minecraft-fossils rcon-cli save-all flush
|
||||
when: fossils_compose.stat.exists
|
||||
register: fossils_save
|
||||
changed_when: fossils_save.rc == 0
|
||||
failed_when: false
|
||||
|
||||
- name: Stop and remove the containers (data stays)
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: /opt/minecraft-fossils
|
||||
project_name: minecraft-fossils
|
||||
state: absent
|
||||
timeout: 120
|
||||
when: fossils_compose.stat.exists
|
||||
|
||||
- name: Disable the daily restart timer
|
||||
ansible.builtin.systemd:
|
||||
name: minecraft-fossils-restart.timer
|
||||
enabled: false
|
||||
state: stopped
|
||||
failed_when: false
|
||||
|
||||
- name: Remove the restart units
|
||||
ansible.builtin.file:
|
||||
path: "/etc/systemd/system/{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- minecraft-fossils-restart.service
|
||||
- minecraft-fossils-restart.timer
|
||||
notify: Reload systemd
|
||||
|
||||
- name: Flush handlers
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Enable the daily restart timer
|
||||
ansible.builtin.systemd:
|
||||
name: minecraft-fossils-restart.timer
|
||||
enabled: true
|
||||
state: started
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue