37 lines
1.2 KiB
YAML
37 lines
1.2 KiB
YAML
#!/usr/bin/env ansible-playbook
|
|
# vim:ft=ansible:
|
|
- name: assure tes3mp {{ tes3mp_name }} directory structure
|
|
ansible.builtin.file:
|
|
state: directory
|
|
owner: "{{ tes3mp_uid }}"
|
|
group: "{{ tes3mp_gid }}"
|
|
mode: "0750"
|
|
path: "{{ item }}"
|
|
recurse: yes
|
|
with_items:
|
|
- "{{ tes3mp_data_prefix }}/data"
|
|
- "{{ 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\""
|
|
- 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"
|