From 42b72a67642f2ef1f5a6323b7724940fad6a1915 Mon Sep 17 00:00:00 2001 From: Saibotk Date: Mon, 20 Jan 2025 00:20:55 +0100 Subject: [PATCH] remove!(minecraft): unused --- playbooks/minecraft.yml | 24 ---- roles/minecraft/README.md | 37 ------ roles/minecraft/defaults/main.yml | 89 -------------- roles/minecraft/handlers/main.yml | 25 ---- roles/minecraft/meta/main.yml | 43 ------- roles/minecraft/tasks/main.yml | 118 ------------------ roles/minecraft/templates/docker-compose.yml | 119 ------------------- roles/minecraft/templates/minecraftctl.sh | 100 ---------------- roles/minecraft/templates/telegraf.conf | 55 --------- 9 files changed, 610 deletions(-) delete mode 100644 playbooks/minecraft.yml delete mode 100644 roles/minecraft/README.md delete mode 100644 roles/minecraft/defaults/main.yml delete mode 100644 roles/minecraft/handlers/main.yml delete mode 100644 roles/minecraft/meta/main.yml delete mode 100644 roles/minecraft/tasks/main.yml delete mode 100644 roles/minecraft/templates/docker-compose.yml delete mode 100644 roles/minecraft/templates/minecraftctl.sh delete mode 100644 roles/minecraft/templates/telegraf.conf diff --git a/playbooks/minecraft.yml b/playbooks/minecraft.yml deleted file mode 100644 index bad5cc1..0000000 --- a/playbooks/minecraft.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -# Infrastructure -# Ansible instructions to deploy the infrastructure -# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern -# Copyright (C) 2020 Saibotk -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -- name: Install & configure Minecraft - hosts: minecraft - roles: - - docker - - docker_cleanup - - minecraft diff --git a/roles/minecraft/README.md b/roles/minecraft/README.md deleted file mode 100644 index 15a0ca9..0000000 --- a/roles/minecraft/README.md +++ /dev/null @@ -1,37 +0,0 @@ -Minecraft -========= - -Setup a Minecraft server container (https://github.com/itzg/docker-minecraft-server) with an optional RCON interface. - -Requirements ------------- - -You will need to have docker, docker-compose and optionally traefik installed or declared as dependencies with their respective roles. - -**This role assumes that (if your are using the RCON webinterface) you have setup traefik with an endpoint called `websecure`.** - -Role Variables --------------- - -**Please look at the [defaults/main.yml](defaults/main.yml) for all available variables and their description.** - -**Note: Lines that are commented out via `#` are usually still valid/used variables, but they are not defined by default, so they might enable a feature, when uncommenting/defining them!** - -### Global variables, that are used: - -**Only when the webinterface is enabled:** - -- `proxy_network`: Defined by the local traefik installation, this is the shared proxy network used by traefik to reach the containers. (optional) -- `proxy_hiddenservice`: Defined by the local traefik installation, this is used to generate the alt-svc header for the alternative Tor domain. (optional) - -Dependencies ------------- - -- docker -- docker-compose -- traefik (optional, only when enabling the webinterface) - -License -------- - -GPL-3.0-only \ No newline at end of file diff --git a/roles/minecraft/defaults/main.yml b/roles/minecraft/defaults/main.yml deleted file mode 100644 index f240e71..0000000 --- a/roles/minecraft/defaults/main.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -# Default variables for the minecraft role - -# Infrastructure -# Ansible instructions to deploy the infrastructure -# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern -# Copyright (C) 2020 Saibotk -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# The install locations -minecraft_install_location: "/srv/minecraft" -minecraft_data_location: "{{ minecraft_install_location }}/data" -minecraft_rcon_location: "{{ minecraft_install_location }}/rcon" -minecraft_backup_location: "{{ minecraft_install_location }}/worlds" -minecraft_telegraf_location: "{{ minecraft_install_location }}/telegraf" - -# renovate: depName=docker.io/itzg/minecraft-server -minecraft_image_version: "2024.10.2" - -# Container versions -minecraft_image_tag: "{{ minecraft_image_version }}" - -# renovate: depName=docker.io/library/telegraf -minecraft_telegraf_version: "1.26.1" - -# Changing this image may also require changing the UID / GID below, -# to set the correct permissions -minecraft_telegraf_image_version: "{{ minecraft_telegraf_version }}-alpine" - -# Telegraf config user & group id -# This is used for the config folder that is mounted to the container -minecraft_telegraf_config_uid: 100 -minecraft_telegraf_config_gid: 101 - -# The minecraft server port that should be exposed -minecraft_server_port: 25565 - -# The certresolver traefik should use for the domain -minecraft_rcon_certresolver: letsencrypt_http - -# The domain under which the rcon web console/websocket is reachable (used by traefik) -minecraft_rcon_domain: minecraft.example.com - -# Should RCON be enabled on the minecraft server? -minecraft_enable_rcon: true - -# Should the RCON webinterface be deployed? -minecraft_enable_rcon_web: false - -# The RCON password -minecraft_rcon_password: "CHANGEME" - -# The minecraft container configuration as environment variables (see https://github.com/itzg/docker-minecraft-server) -minecraft_config: [] - -# This config allows to add new portbindings to the minecraft server, eg. for voicechat. -# -# Example entry: -# - 24454:24454/udp -minecraft_additional_ports: [] - -# IPv6 ULA config for the bridge network used by docker-ipv6-nat -minecraft_ipv6: - enabled: false - subnet: "fd9e:21a7:a92c:2325::/64" - -# Minecraft telegraf configuration, allows to configure a monitoring setup for the minecraft server -minecraft_telegraf: - enabled: false - influxdb_database: "telegraf" - # Your influxDB hosts - influxdb_endpoints: - - "influxdb.example.com" - influxdb_username: telegraf - influxdb_password: "" - influxdb_retention_policy: "minecraft" - influxdb_retention_policy_tag: "" - plugins: [] diff --git a/roles/minecraft/handlers/main.yml b/roles/minecraft/handlers/main.yml deleted file mode 100644 index 8d57604..0000000 --- a/roles/minecraft/handlers/main.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# Handlers for the minecraft role - -# Infrastructure -# Ansible instructions to deploy the infrastructure -# Copyright (C) 2021 Saibotk -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -- name: Restart telegraf - community.docker.docker_compose_v2: - services: "telegraf" - project_src: "{{ minecraft_install_location }}" - state: restarted - become: true diff --git a/roles/minecraft/meta/main.yml b/roles/minecraft/meta/main.yml deleted file mode 100644 index 51da572..0000000 --- a/roles/minecraft/meta/main.yml +++ /dev/null @@ -1,43 +0,0 @@ -galaxy_info: - author: saibotk - description: "Deploys a minecraft server with docker and an optional RCON webinterface." - license: GPL-3.0-only - min_ansible_version: "2.9" - standalone: true - - platforms: - - name: EL - versions: - - all - - name: GenericUNIX - versions: - - all - - name: Fedora - versions: - - all - - name: opensuse - versions: - - all - - name: GenericBSD - versions: - - all - - name: FreeBSD - versions: - - all - - name: Ubuntu - versions: - - all - - name: SLES - versions: - - all - - name: GenericLinux - versions: - - all - - name: Debian - versions: - - all - - galaxy_tags: [] - -dependencies: - - role: docker diff --git a/roles/minecraft/tasks/main.yml b/roles/minecraft/tasks/main.yml deleted file mode 100644 index 6ba00d5..0000000 --- a/roles/minecraft/tasks/main.yml +++ /dev/null @@ -1,118 +0,0 @@ ---- -# Tasks file for the minecraft role - -# Infrastructure -# Ansible instructions to deploy the infrastructure -# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern -# Copyright (C) 2020 Saibotk -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -- name: Update default SELinux contexts - community.general.sefcontext: - target: "{{ item }}(/.*)?" - setype: "container_file_t" - state: present - with_items: - - "{{ minecraft_data_location }}" - - "{{ minecraft_backup_location }}" - - "{{ minecraft_rcon_location }}" - - "{{ minecraft_telegraf_location }}" - become: true - -- name: Create install directory - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: "0700" - owner: "root" - group: "root" - with_items: - - "{{ minecraft_install_location }}" - become: true - tags: - - minecraft - -- name: Create data directories - ansible.builtin.file: # noqa risky-file-permissions # Container manages permissions on its own - path: "{{ item }}" - state: directory - setype: "container_file_t" - with_items: - - "{{ minecraft_data_location }}" - - "{{ minecraft_backup_location }}" - - "{{ minecraft_rcon_location }}" - become: true - tags: - - minecraft - -- name: Create telegraf config directory - ansible.builtin.file: - path: "{{ item }}" - mode: "0700" - owner: "{{ minecraft_telegraf_config_uid }}" - group: "{{ minecraft_telegraf_config_gid }}" - state: directory - setype: "container_file_t" - with_items: - - "{{ minecraft_telegraf_location }}" - become: true - -- name: Deploy telegraf.conf - ansible.builtin.template: - src: telegraf.conf - dest: "{{ minecraft_telegraf_location }}/telegraf.conf" - mode: "0600" - owner: "{{ minecraft_telegraf_config_uid }}" - group: "{{ minecraft_telegraf_config_gid }}" - notify: "Restart telegraf" - tags: - - telegraf - - minecraft - become: true - when: - - minecraft_telegraf.enabled - -- name: Deploy docker-compose.yml - ansible.builtin.template: - src: docker-compose.yml - dest: "{{ minecraft_install_location }}/docker-compose.yml" - mode: "0600" - owner: "root" - group: "root" - validate: docker compose -f %s config -q - tags: - - docker - - minecraft - become: true - -- name: Install minecraftctl CLI - ansible.builtin.template: - src: minecraftctl.sh - dest: "/usr/local/bin/minecraftctl" - mode: "0755" - owner: "root" - group: "root" - tags: - - minecraft - become: true - -- name: Compose minecraft - community.docker.docker_compose_v2: - state: present - project_src: "{{ minecraft_install_location }}" - pull: always - remove_orphans: true - tags: - - minecraft - become: true diff --git a/roles/minecraft/templates/docker-compose.yml b/roles/minecraft/templates/docker-compose.yml deleted file mode 100644 index 36fc8ed..0000000 --- a/roles/minecraft/templates/docker-compose.yml +++ /dev/null @@ -1,119 +0,0 @@ -{{ ansible_managed | comment }} - -# Infrastructure -# Ansible instructions to deploy the infrastructure -# Copyright (C) 2019-2020 Christoph (Sheogorath) Kern -# Copyright (C) 2020 Saibotk -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -version: '2.1' - -services: - minecraft: - image: docker.io/itzg/minecraft-server:{{ minecraft_image_tag }} - ports: - - "{{ minecraft_server_port }}:25565" -{% for item in minecraft_additional_ports %} - - "{{ item }}" -{% endfor %} - volumes: - - "{{ minecraft_data_location }}:/data" - security_opt: - - no-new-privileges - environment: - EULA: "TRUE" - ENABLE_RCON: "{{ minecraft_enable_rcon | bool | lower }}" - RCON_PASSWORD: "{{ minecraft_rcon_password }}" - RCON_PORT: 28016 - # enable env variable replacement - REPLACE_ENV_VARIABLES: "TRUE" - # define an optional prefix for your env variables you want to replace - ENV_VARIABLE_PREFIX: "CFG_" - -{% for key, value in minecraft_config.items() %} - {{ key | upper }}: "{{ value }}" -{% endfor %} - - networks: - minecraft-backend: - - restart: always - -{% if minecraft_enable_rcon_web %} - rcon: - image: docker.io/itzg/rcon - labels: - - "traefik.enable=true" - - - "traefik.http.routers.minecraft-websocket.rule=Host(`{{ minecraft_rcon_domain }}`) && PathPrefix(`/rcon-websocket`)" - - "traefik.http.routers.minecraft-websocket.entrypoints=websecure" - - "traefik.http.routers.minecraft-websocket.tls.certresolver={{ minecraft_rcon_certresolver }}" - - "traefik.http.routers.minecraft-websocket.middlewares=minecraft,compress,minecraft-websocket-stripprefix" - - "traefik.http.routers.minecraft-websocket.service=minecraft-websocket" - - "traefik.http.services.minecraft-websocket.loadbalancer.server.port=4327" - - "traefik.http.middlewares.minecraft-websocket-stripprefix.stripprefix.prefixes=/rcon-websocket" - - - "traefik.http.routers.minecraft.rule=Host(`{{ minecraft_rcon_domain }}`) && PathPrefix(`/`)" - - "traefik.http.routers.minecraft.entrypoints=websecure" - - "traefik.http.routers.minecraft.tls.certresolver={{ minecraft_rcon_certresolver }}" - - "traefik.http.routers.minecraft.middlewares=minecraft,compress" - - "traefik.http.routers.minecraft.service=minecraft" - - "traefik.http.services.minecraft.loadbalancer.server.port=4326" - - "traefik.http.middlewares.minecraft.headers.sslredirect=true" - - "traefik.http.middlewares.minecraft.headers.stsSeconds=63072000" - - "traefik.http.middlewares.minecraft.headers.referrerPolicy=no-referrer" - -{% if proxy_network is defined %} - - "traefik.docker.network={{ proxy_network }}" -{% endif %} - - volumes: - - "{{ minecraft_rcon_location }}:/opt/rcon-web-admin/db" - networks: - minecraft-backend: -{% if proxy_network is defined %} - {{ proxy_network }}: -{% endif %} - - restart: always - -{% endif %} - -{% if minecraft_telegraf.enabled %} - telegraf: - image: docker.io/library/telegraf:{{ minecraft_telegraf_image_version }} - restart: always - mem_limit: 256mb - memswap_limit: 384mb - read_only: false # TODO: Switch to self-made container - networks: - minecraft-backend: - volumes: - - {{ minecraft_telegraf_location }}:/etc/telegraf/:ro -{% endif %} - -networks: - minecraft-backend: - driver: bridge -{% if minecraft_ipv6 is defined and minecraft_ipv6.enabled %} - ipam: - driver: default - config: - - subnet: {{ minecraft_ipv6.subnet }} - enable_ipv6: true -{% endif %} -{% if proxy_network is defined and minecraft_enable_rcon_web %} - {{ proxy_network }}: - external: true -{% endif %} diff --git a/roles/minecraft/templates/minecraftctl.sh b/roles/minecraft/templates/minecraftctl.sh deleted file mode 100644 index 18cfc86..0000000 --- a/roles/minecraft/templates/minecraftctl.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash - -MINECRAFT_PATH="{{ minecraft_data_location }}" - -COMMAND=${1:-help} - -cd "$MINECRAFT_PATH" - -usage() { -cat < - Copies a mod package to the mods directory of the mincraft server - $0 mod-rm - Removes a mod package from the mods directory of the minecraft server - $0 world-ls - Lists backed up worlds - $0 world-rm