-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
main.yml
67 lines (58 loc) · 1.7 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
- hosts: backup
become: true
vars_files:
- config.yml
pre_tasks:
- name: Download and install gickup.
ansible.builtin.unarchive:
src: https://github.com/cooperspencer/gickup/releases/download/v{{ gickup_version }}/gickup_{{ gickup_version }}_linux_arm64.tar.gz
dest: /usr/local/bin
remote_src: true
roles:
- stefangweichinger.ansible_rclone
tasks:
- name: Install mailutils.
ansible.builtin.apt:
name: mailutils
state: present
- name: Copy backup scripts into place.
ansible.builtin.copy:
src: "{{ item }}"
dest: "/home/pi/{{ item }}"
mode: 0755
become: false
loop:
- backup.sh
- gickup.sh
- name: Create mount point directories.
ansible.builtin.file:
path: "/Volumes/{{ item }}"
state: directory
loop: "{{ cifs_volumes }}"
- name: Mount SMB volumes.
ansible.posix.mount:
src: "//{{ cifs_server }}/{{ item }}"
path: "/Volumes/{{ item }}"
fstype: cifs
opts: 'uid=pi,mfsymlinks,username={{ cifs_username }},password={{ cifs_password }}'
state: mounted
loop: "{{ cifs_volumes }}"
- name: Add cron job to run backup weekly, at 0300 on Sundays.
ansible.builtin.cron:
name: Run backup script.
minute: "0"
hour: "3"
weekday: "0"
job: /home/pi/backup.sh
state: present
become: false
- name: Add cron job to run gickup weekly, at 0100 on Sundays.
ansible.builtin.cron:
name: Run gickup script.
minute: "0"
hour: "1"
weekday: "0"
job: /home/pi/gickup.sh
state: present
become: false