Make role actually allow different memory configuration

WOW that took long enough
This commit is contained in:
Salt 2021-01-01 00:32:41 -06:00
parent 1d5f6ced7f
commit fa9a2397a7
3 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,8 @@
file: path={{ minecraft_home }}/{{ minecraft_name }} state=directory file: path={{ minecraft_home }}/{{ minecraft_name }} state=directory
- name: accept eula - name: accept eula
template: src=eula.txt dest={{ minecraft_home }}/{{ minecraft_name }}/eula.txt template: src=eula.txt dest={{ minecraft_home }}/{{ minecraft_name }}/eula.txt
- name: template out env
template: src=env dest={{ minecraft_home }}/{{ minecraft_name }}/env
- name: configure server properties - name: configure server properties
lineinfile: lineinfile:
dest: "{{ minecraft_home }}/{{ minecraft_name }}/server.properties" dest: "{{ minecraft_home }}/{{ minecraft_name }}/server.properties"

2
templates/env Normal file
View File

@ -0,0 +1,2 @@
JRE_XMX={{ minecraft_jre_xmx }}
JRE_XMS={{ minecraft_jre_xms }}

View File

@ -12,6 +12,7 @@ After=network.target
User=minecraft User=minecraft
Group=minecraft Group=minecraft
WorkingDirectory={{ minecraft_home }}/%i WorkingDirectory={{ minecraft_home }}/%i
EnvironmentFile={{ minecraft_home }}/%i/env
PrivateUsers=true PrivateUsers=true
ProtectSystem=full ProtectSystem=full
ProtectHome=true ProtectHome=true
@ -22,7 +23,7 @@ ProtectKernelModules=true
# Implies MountAPIVFS=yes # Implies MountAPIVFS=yes
ProtectControlGroups=true ProtectControlGroups=true
ExecStart=/bin/sh -c '/usr/bin/screen -DmS %i /usr/bin/java -Xms{{ minecraft_jre_xms }} -Xmx{{ minecraft_jre_xmx }} -jar server.jar nogui' ExecStart=/bin/sh -c '/usr/bin/screen -DmS %i /usr/bin/java -Xms${JRE_XMS} -Xmx${JRE_XMX} -jar server.jar nogui'
ExecReload=/usr/bin/screen -p 0 -S %i -X eval 'stuff "reload"\\015' ExecReload=/usr/bin/screen -p 0 -S %i -X eval 'stuff "reload"\\015'