Add boolean to disable a server

This commit is contained in:
Salt 2020-12-29 08:23:06 -06:00
parent d884471153
commit 297f5373ca
3 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,7 @@ Template out the role, ensuring it has root privileges. Set the following vars:
```yaml ```yaml
minecraft_name: Name of the subdirectory of the server minecraft_name: Name of the subdirectory of the server
minecraft_version: Version of Minecraft desired in semver (i.e. 1.7.10, 1.16.4, does not support Beta) minecraft_version: Version of Minecraft desired in semver (i.e. 1.7.10, 1.16.4, does not support Beta)
minecraft_enabled: Boolean to determine state of server (defaults to yes)
``` ```
You must also set one of `minecraft_paper_install` *or* `minecraft_forge_install` depending on desired configuration. Vanilla servers are not supported; use Paper. You must also set one of `minecraft_paper_install` *or* `minecraft_forge_install` depending on desired configuration. Vanilla servers are not supported; use Paper.

View File

@ -1,6 +1,7 @@
# vim:ft=ansible: # vim:ft=ansible:
minecraft_name: default minecraft_name: default
minecraft_version: 1.16.3 minecraft_version: 1.16.3
minecraft_enabled: yes
# minecraft_forge_version: You tell me # minecraft_forge_version: You tell me
# Packages # Packages

View File

@ -85,3 +85,7 @@
when: minecraft_forge_install and minecraft_forge_version is defined when: minecraft_forge_install and minecraft_forge_version is defined
- name: enable service - name: enable service
systemd: name=minecraft@{{ minecraft_name }}.service enabled=yes state=started systemd: name=minecraft@{{ minecraft_name }}.service enabled=yes state=started
when: minecraft_enabled
- name: disable service
systemd: name=minecraft@{{ minecraft_name }}.service enabled=no state=stopped
when: not minecraft_enabled