blob: d75ff0754bc8c11ce9399702ebe20f02bc4f1953 (
plain) (
tree)
|
|
# minecraft ~~ tasks/main.yml
---
- name: create minecraft group
group:
name: "{{ minecraft_group }}"
state: present
- name: create minecraft user
user:
name: "{{ minecraft_user }}"
group: "{{ minecraft_group }}"
- name: create minecraft directory
file:
path: "{{ minecraft_dir }}"
owner: "{{ minecraft_user }}"
group: "{{ minecraft_user }}"
mode: 0700
state: directory
- name: download minecraft server
get_url:
url: "{{ minecraft_url }}"
dest: "{{ minecraft_dir }}/{{ minecraft_bin }}"
owner: "{{ minecraft_user }}"
- name: enable eula
lineinfile:
path: "{{ minecraft_dir }}/eula.txt"
regexp: "^eula=false"
line: eula=true
owner: "{{ minecraft_user }}"
group: "{{ minecraft_group }}"
mode: 0600
create: true
- name: generate launch script
template:
src: launch.sh.j2
dest: "{{ minecraft_dir }}/launch.sh"
owner: "{{ minecraft_user }}"
group: "{{ minecraft_group }}"
mode: 0700
- name: create service minecraft server
include_role: name=rc
vars:
rc_cmd: java
rc_args: "-jar -Xms{{ minecraft_ram }} -Xmx{{ minecraft_ram }} -XX:+UseG1GC -jar server.jar nogui"
rc_user: "{{ minecraft_user }}:{{ minecraft_group }}"
rc_dir: "{{ minecraft_dir }}"
rc_name: minecraft
|