minecraft/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Tue, 12 May 2020 21:24:25 -0500
changeset 19 31de177274a1
child 20 9cacee5eec83
permissions -rw-r--r--
Added minecraft server role.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     1
---
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     2
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     3
- name: add minecract user
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     5
  user: name="{{minecraft_user}}" home="{{minecraft_dir}}"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     6
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     7
- name: install jre
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     8
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     9
  apt: name="default-jre-headless"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    10
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    11
- name: download minecraft
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    12
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    13
  get_url:
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    14
    url: "{{minecraft_url}}"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    15
    dest: "{{minecraft_dir}}/server.jar"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    mode: "0755"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    17
  notify: restart minecraft
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    19
- name: configure eula
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    20
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    21
  copy:
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    22
    src: "eula.txt"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    23
    dest: "{{minecraft_dir}}/eula.txt"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    24
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    25
- name: configure minecraft
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    26
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    27
  template:
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    28
    src: "server.properties.j2"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    29
    dest: "{{minecraft_dir}}/server.properties"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
    owner: "{{minecraft_user}}"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    31
    group: "{{minecraft_user}}"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    32
  notify: restart minecraft
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    33
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    34
- name: install systemd service
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    35
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    36
  template:
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    37
    src: "minecraft.service.j2"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    38
    dest: "/lib/systemd/system/minecraft.service"
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    39
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
- name: ensure service is started
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    41
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    42
  systemd: name="minecraft.service" enabled="yes" state="started"