2022-07-11 00:59:07 -05:00
|
|
|
#!/usr/bin/env ansible-playbook
|
|
|
|
# vim:ft=ansible:
|
|
|
|
- name: assure tes3mp {{ tes3mp_name }} directory structure
|
2022-07-11 02:04:49 -05:00
|
|
|
ansible.builtin.file:
|
2022-07-11 00:59:07 -05:00
|
|
|
state: directory
|
|
|
|
owner: "{{ tes3mp_uid }}"
|
|
|
|
group: "{{ tes3mp_gid }}"
|
|
|
|
mode: "0750"
|
|
|
|
path: "{{ item }}"
|
|
|
|
recurse: yes
|
|
|
|
with_items:
|
|
|
|
- "{{ tes3mp_data_prefix }}/data"
|
2022-07-11 02:04:49 -05:00
|
|
|
- "{{ tes3mp_data_prefix }}/backups"
|
|
|
|
- name: assure tes3mp {{ tes3mp_name }} backup cronjob
|
|
|
|
ansible.builtin.cron:
|
|
|
|
user: root
|
|
|
|
name: "tes3mp-{{ tes3mp_name }}"
|
|
|
|
minute: "*/10"
|
|
|
|
job: "tar czvf \"{{ tes3mp_data_prefix }}/backups/tes3mp-$(date +%Y-%M-%d-%H%M).tgz\" \"{{ tes3mp_data_prefix }}/data\""
|
2022-07-11 00:59:07 -05:00
|
|
|
- name: assure tes3mp {{ tes3mp_name }} container
|
|
|
|
docker_container:
|
|
|
|
name: "tes3mp-{{ tes3mp_name }}"
|
|
|
|
state: started
|
|
|
|
image: "{{ tes3mp_image }}"
|
|
|
|
restart_policy: "{{ tes3mp_restart_policy }}"
|
|
|
|
pull: yes
|
|
|
|
user: "{{ tes3mp_uid }}:{{ tes3mp_gid }}"
|
|
|
|
env:
|
|
|
|
TZ: "{{ tes3mp_timezone }}"
|
|
|
|
TES3MP_SERVER_MAXIMUM_PLAYERS: "{{ tes3mp_server_maximum_players }}"
|
|
|
|
TES3MP_SERVER_HOSTNAME: "{{ tes3mp_server_hostname }}"
|
|
|
|
TES3MP_SERVER_PASSWORD: "{{ tes3mp_server_password }}"
|
|
|
|
ports:
|
|
|
|
- "25565:25565/udp"
|
|
|
|
volumes:
|
|
|
|
- "{{ tes3mp_data_prefix }}/data:/server/data"
|