# 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: install java package package: name: "{{ packages[os_distribution].java }}" - 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: 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