# minecraft ~~ tasks/main.yml --- - name: Check java installation package: name: openjdk11-jre state: present - name: Create minecraft user user: name: "{{ minecraft_user }}" group: "{{ minecraft_user }}" - name: Create minecraft directory file: path: "{{ minecraft_dir }}" owner: "{{ minecraft_user }}" group: "{{ minecraft_user }}" state: directory - name: Download minecraft server get_url: url: "{{ minecraft_url }}" dest: "{{ minecraft_dir }}/{{ minecraft_bin }}" owner: "{{ minecraft_user }}" - name: Enable eula become_user: "{{ minecraft_user }}" shell: echo "eula=true" >> {{ minecraft_dir}}/eula.txt - name: Create rc script include_role: name: rc vars: rc_name: "minecraft" rc_cmd: "/usr/bin/java" rc_args: "-jar {{ minecraft_dir }}/{{ minecraft_bin }}" rc_user: "{{ minecraft_user }}"