Compare commits
No commits in common. "b769ea477bc01123c7c53959ea02e4b4dd528d41" and "831655600c3020d1e7d9328dab73eeb3f5ab280e" have entirely different histories.
b769ea477b
...
831655600c
@ -11,8 +11,8 @@ minecraft_port: 25565
|
||||
minecraft_user: minecraft
|
||||
minecraft_group: minecraft
|
||||
|
||||
minecraft_jar_url: https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
|
||||
minecraft_jar_checksum: sha256:80cf86dc2004ec6a2dc0183d1c75a9af3ba0669f7c332e4247afb1d76fb67e8a
|
||||
minecraft_jar_url: https://launcher.mojang.com/v1/objects/4d1826eebac84847c71a77f9349cc22afd0cf0a1/server.jar
|
||||
minecraft_jar_checksum: sha256:a0c062686bee5a92d60802ca74d198548481802193a70dda6d5fe7ecb7207993
|
||||
|
||||
minecraft_opt_path: /opt/minecraft
|
||||
minecraft_var_path: "{{ minecraft_opt_path }}/var"
|
||||
|
@ -14,9 +14,3 @@
|
||||
service:
|
||||
name: rsyslog
|
||||
state: restarted
|
||||
|
||||
- name: restart minecraft instances
|
||||
service:
|
||||
name: "minecraft@{{ item.name }}.service"
|
||||
state: restarted
|
||||
loop: "{{ minecraft_worlds | default([]) }}"
|
||||
|
@ -37,12 +37,13 @@
|
||||
|
||||
- name: create minecraft var directory
|
||||
file:
|
||||
path: "{{ minecraft_var_path }}/{{ item.name }}"
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ minecraft_user }}"
|
||||
group: "{{ minecraft_group }}"
|
||||
mode: "0755"
|
||||
loop: "{{ minecraft_worlds }}"
|
||||
with_items:
|
||||
- "{{ minecraft_var_path }}"
|
||||
|
||||
- name: download minecraft server
|
||||
get_url:
|
||||
@ -52,31 +53,29 @@
|
||||
group: "{{ minecraft_group }}"
|
||||
mode: "0644"
|
||||
checksum: "{{ minecraft_jar_checksum }}"
|
||||
notify: restart minecraft instances
|
||||
notify: restart minecraft
|
||||
|
||||
- name: agree to the eula
|
||||
copy:
|
||||
content: "eula=true"
|
||||
dest: "{{ minecraft_var_path }}/{{ item.name }}/eula.txt"
|
||||
dest: "{{ minecraft_var_path }}/eula.txt"
|
||||
owner: "{{ minecraft_user }}"
|
||||
group: "{{ minecraft_group }}"
|
||||
mode: "0644"
|
||||
loop: "{{ minecraft_worlds }}"
|
||||
|
||||
- name: configure minecraft
|
||||
template:
|
||||
src: server.properties.j2
|
||||
dest: "{{ minecraft_var_path }}/{{ item.name }}/server.properties"
|
||||
dest: "{{ minecraft_var_path }}/server.properties"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart minecraft instances
|
||||
loop: "{{ minecraft_worlds }}"
|
||||
notify: restart minecraft
|
||||
|
||||
- name: configure systemd unit
|
||||
template:
|
||||
src: minecraft.service.j2
|
||||
dest: /etc/systemd/system/minecraft@.service
|
||||
dest: /etc/systemd/system/minecraft.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
@ -85,30 +84,83 @@
|
||||
|
||||
- name: manage minecraft service
|
||||
service:
|
||||
name: "minecraft@{{ item.name }}"
|
||||
name: "{{ minecraft_service_name }}"
|
||||
state: "{{ minecraft_service_state }}"
|
||||
enabled: "{{ minecraft_service_enabled }}"
|
||||
loop: "{{ minecraft_worlds }}"
|
||||
|
||||
#- name: configure ops
|
||||
# copy:
|
||||
# content: "{{ (minecraft_ops | default([])) | to_nice_json }}"
|
||||
# dest: "{{ minecraft_var_path }}/ops.json"
|
||||
# owner: "{{ minecraft_user }}"
|
||||
# group: "{{ minecraft_group }}"
|
||||
# mode: "0644"
|
||||
# force: no
|
||||
# notify: restart minecraft instances
|
||||
#
|
||||
#- name: configure whitelist
|
||||
# copy:
|
||||
# content: "{{ (minecraft_whitelist | default([])) | to_nice_json }}"
|
||||
# dest: "{{ minecraft_var_path }}/whitelist.json"
|
||||
# owner: "{{ minecraft_user }}"
|
||||
# group: "{{ minecraft_group }}"
|
||||
# mode: "0644"
|
||||
# force: no
|
||||
# notify: restart minecraft instances
|
||||
- name: configure ops
|
||||
copy:
|
||||
content: "{{ (minecraft_ops | default([])) | to_nice_json }}"
|
||||
dest: "{{ minecraft_var_path }}/ops.json"
|
||||
owner: "{{ minecraft_user }}"
|
||||
group: "{{ minecraft_group }}"
|
||||
mode: "0644"
|
||||
force: no
|
||||
notify: restart minecraft
|
||||
|
||||
- name: configure whitelist
|
||||
copy:
|
||||
content: "{{ (minecraft_whitelist | default([])) | to_nice_json }}"
|
||||
dest: "{{ minecraft_var_path }}/whitelist.json"
|
||||
owner: "{{ minecraft_user }}"
|
||||
group: "{{ minecraft_group }}"
|
||||
mode: "0644"
|
||||
force: no
|
||||
notify: restart minecraft
|
||||
|
||||
- name: install backup script
|
||||
copy:
|
||||
src: minecraft-backup.sh
|
||||
dest: "{{ minecraft_opt_path }}/bin/minecraft-backup"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0700
|
||||
|
||||
- name: backup cron job
|
||||
cron:
|
||||
name: minecraft backup
|
||||
minute: "0"
|
||||
hour: "9"
|
||||
user: root
|
||||
job: "{{ minecraft_opt_path }}/bin/minecraft-backup"
|
||||
|
||||
- name: backup clean up cron
|
||||
cron:
|
||||
name: minecraft backup clean up
|
||||
minute: "0"
|
||||
hour: "11"
|
||||
user: root
|
||||
job: "find {{ minecraft_opt_path }}/backup/ -type f -name '*.tar.xz' -ctime +7 -delete"
|
||||
|
||||
- name: set world download password
|
||||
htpasswd:
|
||||
path: "{{ minecraft_opt_path }}/etc/htpasswd"
|
||||
name: minecraft
|
||||
password: minecraft
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: "'nginx' in ansible_play_role_names"
|
||||
|
||||
- name: configure nginx
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: /etc/nginx/sites-available/minecraft
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: "'nginx' in ansible_play_role_names"
|
||||
notify: reload nginx
|
||||
|
||||
- name: activate site
|
||||
file:
|
||||
src: /etc/nginx/sites-available/minecraft
|
||||
dest: /etc/nginx/sites-enabled/minecraft
|
||||
owner: root
|
||||
group: root
|
||||
state: link
|
||||
when: "'nginx' in ansible_play_role_names"
|
||||
notify: reload nginx
|
||||
|
||||
- name: install discord notifier
|
||||
copy:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Minecraft server %i
|
||||
Description=Minecraft server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
@ -10,7 +10,7 @@ SuccessExitStatus=143
|
||||
Type=simple
|
||||
User={{ minecraft_user }}
|
||||
Group={{ minecraft_group }}
|
||||
WorkingDirectory={{ minecraft_var_path }}/%i
|
||||
WorkingDirectory={{ minecraft_var_path }}
|
||||
Restart=on-failure
|
||||
SyslogIdentifier=minecraft
|
||||
SyslogFacility={{ minecraft_syslog_facility }}
|
||||
|
@ -1,3 +1,2 @@
|
||||
white-list: {{ (minecraft_config.whitelist | default(true)) | ternary('true', 'false') }}
|
||||
enforce-whitelist: {{ (minecaft_config.enfoce_whitelist | default(true)) | ternary('true', 'false') }}
|
||||
server-port: {{ item.port | default(25565) }}
|
||||
|
Loading…
Reference in New Issue
Block a user