Pijus Kamandulis ea46b13a17 Initial commit
2022-01-28 18:02:57 +02:00

29 lines
765 B
YAML

---
- hosts: '{{ target | default("all") }}'
become: yes
become_method: sudo
tasks:
- name: Save world
ansible.builtin.command: echo "saveworld" | nc -w 5 localhost 8081
- name: Shutdown server
ansible.builtin.command: echo "shutdown" | nc -w 5 localhost 8081
- name: Stop service
ansible.builtin.service:
name: 7days
state: stopped
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /data/backup
state: directory
mode: '0755'
- name: Make save backup
community.general.archive:
path: /data/Saves
dest: /data/backup/{{ ansible_date_time.date }}_{{ ansible_date_time.hour }}-{{ ansible_date_time.minute }}.tar.gz
format: gz