aboutsummaryrefslogblamecommitdiffstats
path: root/roles/minecraft/tasks/main.yml
blob: d78aa6ecedcfd32d36e7b98d9fce098a63a4168b (plain) (tree)
1
2
3
4
5
6
7
8
9
10




                             




                                 
                             

                                
                                  
                
 
                                  
       


                                 
              

                    
                                 



                                                   
              
 
                   
             
                                        

                         




                                  



                                       
                                                                                                 


                                                         
                       

# 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 }}"
    system: true

- 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 }}"
    mode: 0644

- 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: "-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
    rc_strictpexp: true
remember that computers suck.