]> git.somenet.org - root/pub/somesible.git/blob - roles/base/btrfs-helpers/tasks/main.yml
roles/base/backup/files
[root/pub/somesible.git] / roles / base / btrfs-helpers / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: make sure /btrfs exists
9   file:
10     path: "/btrfs"
11     state: directory
12     mode: 0711
13     owner: "root"
14     group: "root"
15   when: setup_btrfs_helpers | bool
16
17
18 - name: copy btrfs-snapshot.sh
19   copy:
20     src: "{{item}}"
21     dest: "/btrfs/btrfs-snapshot.sh"
22     mode: 0700
23     owner: "root"
24     group: "root"
25   with_first_found:
26     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/btrfs-snapshot.sh"
27     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/btrfs-snapshot.sh"
28     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/btrfs-snapshot.sh"
29     - "default/btrfs-snapshot.sh"
30   when: setup_btrfs_helpers | bool
31
32
33 - name: copy btrfs-regen-snaphot-homelinks.sh
34   copy:
35     src: "{{item}}"
36     dest: "/btrfs/btrfs-regen-snaphot-homelinks.sh"
37     mode: 0700
38     owner: "root"
39     group: "root"
40   with_first_found:
41     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/btrfs-regen-snaphot-homelinks.sh"
42     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/btrfs-regen-snaphot-homelinks.sh"
43     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/btrfs-regen-snaphot-homelinks.sh"
44     - "default/btrfs-regen-snaphot-homelinks.sh"
45   when: setup_btrfs_helpers | bool
46
47
48 - name: setup cron.d file for btrfs snapshots + scrub.
49   template:
50     src: "{{item}}"
51     dest: "/etc/cron.d/btrfs"
52     mode: 0644
53     owner: "root"
54     group: "root"
55   with_first_found:
56     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/cron.j2"
57     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/cron.j2"
58     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/cron.j2"
59     - "templates/cron.j2"
60   when: setup_btrfs_helpers | bool