papermc/tasks/main.yaml
author Luke Hoersten <luke@hoersten.org>
Sun, 28 Jun 2020 15:08:36 -0500
changeset 54 1ea4f1c7c675
parent 42 edb53dfadfb5
child 59 b339d3c51504
permissions -rw-r--r--
Updated client templating in adguard.
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
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
     3
- name: add papermc user
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
     4
  become: yes
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
     5
  user: name="{{papermc_user}}" home="{{papermc_dir}}"
19
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
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    11
- name: download papermc
19
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:
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    14
    url: "{{papermc_url}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    15
    dest: "{{papermc_dir}}/server.jar"
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    16
    mode: "0755"
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    17
  notify: restart papermc
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    18
20
9cacee5eec83 Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    19
- name: configure eula and ops
19
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:
20
9cacee5eec83 Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    22
    src: "{{item}}"
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    23
    dest: "{{papermc_dir}}/{{item}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    24
    owner: "{{papermc_user}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    25
    group: "{{papermc_user}}"
20
9cacee5eec83 Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    26
  loop:
9cacee5eec83 Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    27
    - "eula.txt"
9cacee5eec83 Added ops to minecraft role.
Luke Hoersten <luke@hoersten.org>
parents: 19
diff changeset
    28
    - "ops.json"
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    29
  notify: restart papermc
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    30
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    31
- name: set motd
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    32
  become: yes
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    33
  lineinfile:
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    34
    path: "{{papermc_dir}}/server.properties"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    35
    regexp: "^motd="
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    36
    line: "motd={{papermc_motd}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    37
  notify: restart papermc
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    38
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    39
- name: create world file directory
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    40
  become: yes
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    41
  file:
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    42
    path: "{{papermc_world_dir}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    43
    state: "directory"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    44
    owner: "{{papermc_user}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    45
    group: "{{papermc_user}}"
42
edb53dfadfb5 Moved to ext4 for permissions on hdd.
Luke Hoersten <luke@hoersten.org>
parents: 33
diff changeset
    46
    recurse: "yes"
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    47
    mode: "0755"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    48
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    49
- name: set world files
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    50
  become: yes
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    51
  lineinfile:
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    52
    path: "{{papermc_dir}}/bukkit.yml"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    53
    regexp: "^  world-container:"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    54
    line: "  world-container: {{papermc_world_dir}}"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    55
    insertbefore: "^  permissions-file:"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    56
  notify: restart papermc
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    57
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    58
- name: install systemd service
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    59
  become: yes
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    60
  template:
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    61
    src: "papermc.service.j2"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    62
    dest: "/lib/systemd/system/papermc.service"
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    63
  notify: restart papermc
19
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    64
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    65
- name: ensure service is started
31de177274a1 Added minecraft server role.
Luke Hoersten <luke@hoersten.org>
parents:
diff changeset
    66
  become: yes
33
ad75fc2d2853 Added papermc role.
Luke Hoersten <luke@hoersten.org>
parents: 27
diff changeset
    67
  systemd: name="papermc.service" enabled="yes" state="started"