diff --git a/ansible/inventory/hosts.yml b/ansible/inventory/hosts.yml index dc9fe0a..be29106 100644 --- a/ansible/inventory/hosts.yml +++ b/ansible/inventory/hosts.yml @@ -12,7 +12,7 @@ all: cloud-pc: ansible_host: 10.122.62.51 # ansible_host: 192.168.1.5 - ansible_ssh_common_args: '-J mini-pc' + ansible_ssh_common_args: '-J vps' expected_lan_ip: 192.168.1.5 storage_mounts: - src: UUID=ae278333-4116-4225-9b95-595496fadd26 diff --git a/ansible/playbooks/rclone.yml b/ansible/playbooks/rclone.yml new file mode 100644 index 0000000..738e529 --- /dev/null +++ b/ansible/playbooks/rclone.yml @@ -0,0 +1,9 @@ +- name: Install rclone + hosts: servers + become: true + tasks: + - name: Install rclone package + ansible.builtin.apt: + name: rclone + state: present + update_cache: true diff --git a/ansible/playbooks/resticprofile.yml b/ansible/playbooks/resticprofile.yml new file mode 100644 index 0000000..52ad666 --- /dev/null +++ b/ansible/playbooks/resticprofile.yml @@ -0,0 +1,36 @@ +- name: Install resticprofile + hosts: servers + become: true + tasks: + - name: Install restic package + ansible.builtin.apt: + name: restic + state: present + update_cache: true + + - name: Create restic config directory + ansible.builtin.file: + path: /etc/restic + state: directory + owner: root + group: root + mode: "0755" + + - name: Create resticprofile log directory + ansible.builtin.file: + path: /var/log/resticprofile + state: directory + owner: root + group: root + mode: "0755" + + - name: Download resticprofile install script + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/creativeprojects/resticprofile/master/install.sh + dest: /tmp/resticprofile-install.sh + mode: "0755" + + - name: Install resticprofile binary + ansible.builtin.command: + cmd: /tmp/resticprofile-install.sh -b /usr/local/bin + creates: /usr/local/bin/resticprofile diff --git a/cloud-pc/resticprofile/profiles.toml b/cloud-pc/resticprofile/profiles.toml index b07b565..c054683 100644 --- a/cloud-pc/resticprofile/profiles.toml +++ b/cloud-pc/resticprofile/profiles.toml @@ -52,4 +52,47 @@ version = "1" schedule-log = "/var/log/resticprofile/samba.log" [samba.forget] - schedule = "03:30" \ No newline at end of file + schedule = "03:30" + +# ── Yandex Disk: ночная удалённая копия ─────────────────────────────────────── +[yadisk-default] + inherit = "default" + + [yadisk-default.check] + schedule = "Sun 06:00" + schedule-permission = "system" + schedule-after-network-online = true + +[yadisk-services] + inherit = "yadisk-default" + repository = "rclone:yadisk:System/Backups/cloud-pc/restic/services" + + [yadisk-services.backup] + source = ["/opt/data", "/opt/configs"] + tag = ["cloud-pc", "services", "yadisk"] + exclude-caches = true + one-file-system = true + schedule = "04:00" + schedule-permission = "system" + schedule-after-network-online = true + schedule-log = "/var/log/resticprofile/yadisk-services.log" + + [yadisk-services.forget] + schedule = "04:30" + +[yadisk-samba] + inherit = "yadisk-default" + repository = "rclone:yadisk:System/Backups/cloud-pc/restic/samba" + + [yadisk-samba.backup] + source = ["/opt/samba"] + tag = ["cloud-pc", "samba", "yadisk"] + exclude-caches = true + one-file-system = true + schedule = "05:00" + schedule-permission = "system" + schedule-after-network-online = true + schedule-log = "/var/log/resticprofile/yadisk-samba.log" + + [yadisk-samba.forget] + schedule = "05:30" diff --git a/mini-pc/resticprofile/profiles.toml b/mini-pc/resticprofile/profiles.toml new file mode 100644 index 0000000..893e8f5 --- /dev/null +++ b/mini-pc/resticprofile/profiles.toml @@ -0,0 +1,38 @@ +version = "1" + +[global] + scheduler = "systemd" + +[default] + password-file = "/etc/restic/password" + initialize = true + + [default.forget] + keep-daily = 7 + keep-weekly = 4 + keep-monthly = 6 + schedule-permission = "system" + schedule-after-backup = true + prune = true + + [default.check] + schedule = "Sun 04:00" + schedule-permission = "system" + schedule-after-network-online = true + +[services] + inherit = "default" + repository = "rclone:yadisk:System/Backups/mini-pc/restic/services" + + [services.backup] + source = ["/opt/data", "/opt/configs"] + tag = ["mini-pc", "services"] + exclude-caches = true + one-file-system = true + schedule = "03:00" + schedule-permission = "system" + schedule-after-network-online = true + schedule-log = "/var/log/resticprofile/services.log" + + [services.forget] + schedule = "03:30" diff --git a/ru-vps/resticprofile/profiles.toml b/ru-vps/resticprofile/profiles.toml new file mode 100644 index 0000000..d729430 --- /dev/null +++ b/ru-vps/resticprofile/profiles.toml @@ -0,0 +1,38 @@ +version = "1" + +[global] + scheduler = "systemd" + +[default] + password-file = "/etc/restic/password" + initialize = true + + [default.forget] + keep-daily = 7 + keep-weekly = 4 + keep-monthly = 6 + schedule-permission = "system" + schedule-after-backup = true + prune = true + + [default.check] + schedule = "Sun 04:00" + schedule-permission = "system" + schedule-after-network-online = true + +[services] + inherit = "default" + repository = "rclone:yadisk:System/Backups/ru-vps/restic/services" + + [services.backup] + source = ["/opt/data", "/opt/configs"] + tag = ["ru-vps", "services"] + exclude-caches = true + one-file-system = true + schedule = "03:00" + schedule-permission = "system" + schedule-after-network-online = true + schedule-log = "/var/log/resticprofile/services.log" + + [services.forget] + schedule = "03:30"