Skip to content

Commit 7595f3d

Browse files
authored
Merge pull request #9 from PleaseStopAsking/main
Add verbose option for logging
2 parents 4c48eb1 + 87c9fae commit 7595f3d

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

.gitpod.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
image: ghcr.io/dbrennand/ansible-gitpod-workspace:latest
32

43
vscode:

README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ Whether or not to run `autorestic check` to make sure backends are configured pr
7979

8080
```yaml
8181
autorestic_cron: false
82+
autorestic_cron_verbose: false
8283
```
8384

84-
Whether or not to create an autorestic crontab entry to trigger automated backups. Autorestic locations need to be configured with `cron`.
85+
Whether or not to create an autorestic crontab entry to trigger automated backups. Use `autorestic_cron_verbose` to enable verbose logging. Autorestic locations need to be configured with [`cron`](https://autorestic.vercel.app/location/cron).
8586

8687
```yaml
8788
autorestic_state: present
@@ -121,3 +122,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) for
121122
[**dbrennand**](https://github.com/dbrennand) - *Author*
122123

123124
[**whysthatso**](https://github.com/whysthatso) - *Contributor*
125+
126+
[**PleaseStopAsking**](https://github.com/PleaseStopAsking) - *Contributor*

defaults/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ autorestic_config: |-
2525
autorestic_info: false
2626
autorestic_check: false
2727
autorestic_cron: false
28+
autorestic_cron_verbose: false
2829
autorestic_state: present

tasks/autorestic.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,30 @@
1414
ansible.builtin.get_url:
1515
url: "https://github.com/cupcakearmy/autorestic/releases/download/v{{ autorestic_version }}/autorestic_{{ autorestic_version }}_linux_arm64.bz2" # noqa yaml[line-length]
1616
dest: /tmp/autorestic.bz2
17-
mode: 0644
17+
mode: "0644"
1818
when: ansible_architecture == "aarch64"
1919

2020
- name: "Download autorestic binary for armv7l v{{ autorestic_version }}"
2121
# E.g., Raspberry Pi 3 (32bit)
2222
ansible.builtin.get_url:
2323
url: "https://github.com/cupcakearmy/autorestic/releases/download/v{{ autorestic_version }}/autorestic_{{ autorestic_version }}_linux_arm.bz2"
2424
dest: /tmp/autorestic.bz2
25-
mode: 0644
25+
mode: "0644"
2626
when: ansible_architecture == "armv7l"
2727

2828
- name: "Download autorestic binary for x86_64 v{{ autorestic_version }}"
2929
ansible.builtin.get_url:
3030
url: "https://github.com/cupcakearmy/autorestic/releases/download/v{{ autorestic_version }}/autorestic_{{ autorestic_version }}_linux_amd64.bz2" # noqa yaml[line-length]
3131
dest: /tmp/autorestic.bz2
32-
mode: 0644
32+
mode: "0644"
3333
when: ansible_architecture == "x86_64"
3434

3535
- name: "Download autorestic binary for other architectures v{{ autorestic_version }}"
3636
# Generic list containing available linux builds
3737
ansible.builtin.get_url:
3838
url: "https://github.com/cupcakearmy/autorestic/releases/download/v{{ autorestic_version }}/autorestic_{{ autorestic_version }}_linux_{{ item }}.bz2"
3939
dest: /tmp/autorestic.bz2
40-
mode: 0644
40+
mode: "0644"
4141
when: ansible_architecture == item
4242
with_items:
4343
- mips

tasks/main.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
ansible.builtin.copy:
5050
content: "{{ autorestic_config }}"
5151
dest: ~/.autorestic.yml
52-
mode: 0600
52+
mode: "0600"
5353

5454
- name: Run autorestic info
5555
ansible.builtin.command:
@@ -77,4 +77,9 @@
7777
ansible.builtin.cron:
7878
name: Configure autorestic crontab job
7979
minute: "*/5"
80-
job: autorestic -c ~/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1
80+
job: |
81+
{% if autorestic_cron_verbose == true %}
82+
autorestic -c ~/.autorestic.yml --ci cron -vvvvv > /tmp/autorestic.log 2>&1
83+
{% else %}
84+
autorestic -c ~/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1
85+
{% endif %}

tasks/restic.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,30 @@
1414
ansible.builtin.get_url:
1515
url: "https://github.com/restic/restic/releases/download/v{{ autorestic_restic_version }}/restic_{{ autorestic_restic_version }}_linux_arm64.bz2"
1616
dest: /tmp/restic.bz2
17-
mode: 0644
17+
mode: "0644"
1818
when: ansible_architecture == "aarch64"
1919

2020
- name: "Download restic binary for armv7l v{{ autorestic_restic_version }}"
2121
# E.g., Raspberry Pi 3 (32bit)
2222
ansible.builtin.get_url:
2323
url: "https://github.com/restic/restic/releases/download/v{{ autorestic_restic_version }}/restic_{{ autorestic_restic_version }}_linux_arm.bz2"
2424
dest: /tmp/restic.bz2
25-
mode: 0644
25+
mode: "0644"
2626
when: ansible_architecture == "armv7l"
2727

2828
- name: "Download restic binary for x86_64 v{{ autorestic_restic_version }}"
2929
ansible.builtin.get_url:
3030
url: "https://github.com/restic/restic/releases/download/v{{ autorestic_restic_version }}/restic_{{ autorestic_restic_version }}_linux_amd64.bz2"
3131
dest: /tmp/restic.bz2
32-
mode: 0644
32+
mode: "0644"
3333
when: ansible_architecture == "x86_64"
3434

3535
- name: "Download restic binary for other architectures v{{ autorestic_restic_version }}"
3636
# Generic list containing available linux builds
3737
ansible.builtin.get_url:
3838
url: "https://github.com/restic/restic/releases/download/v{{ autorestic_restic_version }}/restic_{{ autorestic_restic_version }}_linux_{{ item }}.bz2"
3939
dest: /tmp/restic.bz2
40-
mode: 0644
40+
mode: "0644"
4141
when: ansible_architecture == item
4242
with_items:
4343
- mips

0 commit comments

Comments
 (0)