-
Notifications
You must be signed in to change notification settings - Fork 13
moar features! #9
base: master
Are you sure you want to change the base?
Changes from 10 commits
4efff40
ef47267
8d9dde6
e4202bf
10532fc
bd769aa
e242f2b
96beed9
7ec815c
f7caee0
54dae41
5d9a89a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,101 @@ | ||
| --- | ||
|
|
||
| ## | ||
| ## borgbackup package/binary installation | ||
| ## | ||
| borgbackup_install_from_binary: True | ||
| borgbackup_install_from_repo: False | ||
|
|
||
| borgbackup_binary_version: "1.0.9" | ||
| borgbackup_binary_version: "1.1.4" | ||
| borgbackup_binary_platform: "borg-linux64" | ||
| borgbackup_binary_uri: "https://github.com/borgbackup/borg/releases/download/{{ borgbackup_binary_version }}/{{ borgbackup_binary_platform }}" | ||
| borgbackup_binary: "/usr/local/bin/borg" | ||
|
|
||
| ## | ||
| ## borgbackup server configuration | ||
| ## | ||
| borgbackup_server: False | ||
| borgbackup_server_user: "borgbackup" | ||
| borgbackup_server_group: "borgbackup" | ||
| borgbackup_server_home: "/srv/borgbackup" | ||
| borgbackup_server_pool: "{{ borgbackup_server_home }}/repos" | ||
| # ssh pubkey list of sysadmins that manage the borg server | ||
| borgbackup_server_admins: [] | ||
|
|
||
| ## | ||
| ## borgbackup general configuration | ||
| ## | ||
| # encryption | ||
| borgbackup_encryption_mode: "none" | ||
| borgbackup_passphrase: "yoursecret" | ||
|
|
||
| ## | ||
| ## borg client configuration | ||
| ## | ||
| borgbackup_client: False | ||
|
|
||
| # Specify the SSH private key type to use. By default role will generate | ||
| # ED25519 keys if they are supported by the remote host, otherwise RSA keys | ||
| # will be generated. | ||
| borgbackup_client_ssh_key_type: '{{ "ed25519" | ||
| if ("ssh-ed25519" in borgbackup_register_key_types.stdout_lines) | ||
| else "rsa" }}' | ||
|
|
||
| borgbackup_client_ssh_key_file: "/root/.ssh/id_{{ borgbackup_client_ssh_key_type }}-backup" | ||
| borgbackup_client_ssh_key_comment: 'root@{{ ansible_hostname }} generated by Ansible' | ||
| borgbackup_client_scripts_dir: "/etc/borg" | ||
| borgbackup_encryption_mode: "none" | ||
| borgbackup_passphrase: "yoursecret" | ||
| #borgbackup_client_backup_server: backup01.example.com | ||
| #borgbackup_client_jobs: | ||
|
|
||
| # lastlog parsed by supervision | ||
| borgbackup_client_lastlog_dir: "/var/cache/borg" | ||
|
|
||
| # backup server IP or FQDN used during ansible installation AND backup operation. | ||
| borgbackup_client_backup_server: | ||
|
|
||
| # if defined, IP or FQDN used on backup operation. Usefull in case of LAN-free backup | ||
| borgbackup_client_backup_server_lanfreebackup: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, role execution shouldn't fail because of that. |
||
|
|
||
| # you have to set at least a "create" job. | ||
| # "prune" and "checks" jobs are optionnal, but you should use it too. | ||
| borgbackup_create_jobs: | ||
|
|
||
| # borgbackup jobs examples : | ||
| #borgbackup_create_jobs: | ||
| # - name: system | ||
| # options: "--compression zlib,6" | ||
| # options: "--lock-wait 7200 --compression lzma" | ||
| # day: "*" | ||
| # hour: "{{ 6 | random }}" | ||
| # minute: "{{ 59 | random }}" | ||
| # hour: 0 # default value = 1 | ||
| # minute: 0 # default value = 0 | ||
| # random_hour: 5 # default value : ignore randomization | ||
| # random_minute: 59 # default value : ignore randomization | ||
| # directories: | ||
| # - "/etc/" | ||
| # - "/home" | ||
| # excludes: [] | ||
|
|
||
| borgbackup_server: False | ||
| borgbackup_server_user: "borgbackup" | ||
| borgbackup_server_group: "borgbackup" | ||
| borgbackup_server_home: "/srv/borgbackup" | ||
| borgbackup_server_pool: "{{ borgbackup_server_home }}/repos" | ||
|
|
||
| borgbackup_prune_enabled: yes | ||
| borgbackup_prune_jobs: | ||
| - name: system | ||
| prune_options: "--keep-daily=7 --keep-weekly=4" | ||
| day: "*" | ||
| hour: "{{ 4 }}" | ||
| minute: "{{ 0 }}" | ||
| - name: scripts | ||
| prune_options: "--keep-within=10d" | ||
| day: "*" | ||
| hour: "{{ 4 }}" | ||
| minute: "{{ 0 }}" | ||
| #borgbackup_prune_jobs: | ||
| # - name: system | ||
| # prune_options: "--lock-wait 7200 --keep-daily=7 --keep-weekly=4 --keep-monthly=12 --keep-yearly=-1" | ||
| # day: "*" | ||
| # hour: 12 # default value = 1 | ||
| # minute: 0 # default value = 0 | ||
| # random_hour: 5 # default value : ignore randomization | ||
| # random_minute: 59 # default value : ignore randomization | ||
|
|
||
| borgbackup_check_enabled: yes | ||
| #borgbackup_check_jobs: | ||
| # - name: system | ||
| # check_options: "--lock-wait 28800" | ||
| # day: 1 | ||
| # hour: 12 # default value = 1 | ||
| # minute: 0 # default value = 0 | ||
| # random_hour: 5 # default value : ignore randomization | ||
| # random_minute: 59 # default value : ignore randomization | ||
| # random_day: 27 # default value : ignore randomization | ||
|
|
||
| # about random : | ||
| # TL;DR : if 'random_hour' is set, then 'hour' will be set by a random value within range 'hour' up to 'hour+random_hour' | ||
| # purpose is to set indempotent random crontab values. Usefull when many jobs are croned toward a small number of repository servers. | ||
| # random_hour : if defined, a indempotent random value is computed between 0 and the value specified. | ||
| # Then, the crontab hour will be addition of hour and random_hour. | ||
| # a modulo 24 is applied in order to ensure valid hour are specified. | ||
| # random_minute and random_day works the same way. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| --- | ||
|
|
||
| # | ||
| # server installation task | ||
| # | ||
|
|
||
| - name: create group for borg | ||
| group: | ||
| name: "{{ borgbackup_server_group }}" | ||
|
|
@@ -32,3 +36,9 @@ | |
| group: "{{ borgbackup_server_group }}" | ||
| mode: 0600 | ||
| state: touch | ||
|
|
||
| - name: add ssh-pubkey admin users to backup server | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please make it so that I suggest having something like in the in the tasks file
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice idea. Change done! |
||
| authorized_key: | ||
| user: "{{ borgbackup_server_user }}" | ||
| key: "{{ item }}" | ||
| with_items: "{{ borgbackup_server_admins }}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,14 @@ | ||
| --- | ||
|
|
||
| - name: Download borg binary | ||
| get_url: url="{{ borgbackup_binary_uri }}" dest="{{ borgbackup_binary }}" mode=755 | ||
| get_url: | ||
| url: "{{ borgbackup_binary_uri }}" | ||
| dest: "{{ borgbackup_binary }}-{{ borgbackup_binary_version }}" | ||
| mode: "755" | ||
|
|
||
| - name: Link install | ||
| file: | ||
| src: "{{ borgbackup_binary }}-{{ borgbackup_binary_version }}" | ||
| dest: "{{ borgbackup_binary }}" | ||
| state: link | ||
| force: yes |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| export BORG_RSH="ssh -i {{ borgbackup_client_ssh_key_file }}" | ||
| export BORG_PASSPHRASE="{{ borgbackup_passphrase }}" | ||
|
|
||
| REPOSITORY={{ borgbackup_server_user }}@{{ borgbackup_client_backup_server_lanfreebackup | default(borgbackup_client_backup_server) }}:{{ item.name }} | ||
|
|
||
| {{ borgbackup_binary }} check --show-rc --verbose \ | ||
| {{ item.check_options }} \ | ||
| $REPOSITORY \ | ||
| 2>&1 | tee {{ borgbackup_client_lastlog_dir }}/{{ item.name }}_{{ check_suffix_script_filename }}.lastlog \ | ||
| | /usr/bin/logger -t borgbackup_check_{{ item.name }}_{{ borgbackup_client_backup_server }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| export BORG_RSH="ssh -i {{ borgbackup_client_ssh_key_file }}" | ||
| export BORG_PASSPHRASE="{{ borgbackup_passphrase }}" | ||
|
|
||
| REPOSITORY={{ borgbackup_server_user }}@{{ borgbackup_client_backup_server_lanfreebackup | default(borgbackup_client_backup_server) }}:{{ item.name }} | ||
|
|
||
| {{ borgbackup_binary }} create --show-rc --verbose --stats \ | ||
| {{ item.options | default('--compression zlib,6') }} \ | ||
| $REPOSITORY::{{ ansible_hostname }}-$(date +%Y-%m-%d_%H-%M) \ | ||
| {{ item.directories | join(' ') }} \ | ||
| {% for e in item.excludes %} | ||
| --exclude '{{ e }}' \ | ||
| {% endfor %} | ||
| 2>&1 | tee {{ borgbackup_client_lastlog_dir }}/{{ item.name }}_{{ create_suffix_script_filename }}.lastlog \ | ||
| | /usr/bin/logger -t borgbackup_backup_{{ item.name }}_{{ borgbackup_client_backup_server }} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this should be
/var/log/borg.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lastlog is overwritten on each create/prune/check execution. It's a lastlog and not a log of all execution. (Thoses are sent to syslog). I need that to get a easier last status seen for supervision purpose. That's why I was thinking that /var/cache was better than /var/log.
Anyway, it's just a default value, so I'm ok to change it.