fixed ansible pull backups

pull/25/head
Cian Hatton 3 years ago
parent 62f3ee4316
commit 538ea01946

@ -33,3 +33,6 @@ backup: deps
restore: deps
ansible-playbook playbooks/restore-docker-volumes.yml
cron:
ansible-playbook playbooks/setup-homelab.yml --tags cron

@ -7,7 +7,7 @@
user:
name: ansible
groups: root
system: true
shell: /bin/bash
- name: Add ssh key for ansible
authorized_key:

@ -105,16 +105,25 @@
state: present
with_items: '{{services}}'
- name: Install Ansible pull
tags: ["cron"]
ansible.builtin.pip:
name:
- ansible
# TODO: need to specify ansible pull directly, it doesn't find it when it's in PATH
- name: Ensure Nightly Cron Backups
tags: ["cron"]
ansible.builtin.cron:
name: backup docker volumes (nightly)
weekday: "0"
minute: "0"
hour: "3"
user: ansible
job: "ansible-pull -U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=nightly >> /home/cianhatton/logs/nightly.log 2>&1"
hour: "4"
user: "{{ homelab_user }}"
job: "/home/{{ homelab_user }}/.local/bin/ansible-pull -U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=nightly >> ~/logs/nightly.log 2>&1"
cron_file: ansible_nightly_docker_volume_backup
state: present
- name: Ensure Monthly Cron Backups
tags: ["cron"]
@ -122,6 +131,7 @@
name: backup docker volumes (monthly)
month: "*"
day : "1"
user: ansible
job: "ansible-pull -U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=monthly >> /home/cianhatton/logs/monthly.log 2>&1"
user: "{{ homelab_user }}"
job: "/home/{{ homelab_user }}/.local/bin/ansible-pull -U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=monthly >> ~/logs/monthly.log 2>&1"
cron_file: ansible_monthly_docker_volume_backup
state: present

Loading…
Cancel
Save