From 4fa25a175495f75cc9340baa51e16a8903d6ec08 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 11 Jun 2019 10:32:58 -0300 Subject: Run shutdown with Ansible instead of Bash --- shutdown.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 shutdown.yaml (limited to 'shutdown.yaml') diff --git a/shutdown.yaml b/shutdown.yaml new file mode 100644 index 0000000..efda810 --- /dev/null +++ b/shutdown.yaml @@ -0,0 +1,17 @@ +--- +- hosts: all + any_errors_fatal: true + tasks: + - name: Copy files for performing the backup + copy: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }} + with_items: + - { src: './generated/create-backup.sh', dest: '/home/vps/create-backup.sh', mode: '500' } + - { src: './secrets/borg/borg-remote.pub', dest: '/root/.ssh/id_rsa.pub', mode: '400' } + - { src: './secrets/borg/borg-remote', dest: '/root/.ssh/id_rsa', mode: '400' } + - { src: './secrets/borg/known-hosts.txt', dest: '/root/.ssh/known_hosts', mode: '400' } + - name: Stop docker-compose + docker_service: + project_src: /home/vps/ + state: absent + - name: Create a borg backup of the volume + shell: /home/vps/create-backup.sh -- cgit v1.3