Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit ae2b9fe

Browse files
committed
Backup: Added user agent to Rclone command.
1 parent fa35129 commit ae2b9fe

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

roles/backup/tasks/main.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@
256256
- name: Snapshot | Delete btrfs snapshot
257257
command: "btrfs subvolume delete /btrfs/snapshots/root"
258258
when: (use_snapshot) and (snapshot_type == 'btrfs')
259+
ignore_errors: yes
259260

260261
- name: Check if tar files were created
261262
find:
@@ -340,7 +341,11 @@
340341

341342
# Due to a touch command in a previous backup, all files on rclone.destination have same mod dates, therefore, only one file's mod date is needed.
342343
- name: "Get datestamp for previous '{{ rclone.destination }}/settings.yml'"
343-
shell: "rclone lsl {{ rclone.destination }}/settings.yml | sed -e 's/^[ \t]*//' | cut -d ' ' -f 2,3 | cut -d '.' -f 1 | sed s/' '/_/g | sed s/':'/./g"
344+
shell: |
345+
/usr/bin/rclone lsl \
346+
{{ rclone.destination }}/settings.yml \
347+
--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36' \
348+
| sed -e 's/^[ \t]*//' | cut -d ' ' -f 2,3 | cut -d '.' -f 1 | sed s/' '/_/g | sed s/':'/./g
344349
become: yes
345350
become_user: "{{ user }}"
346351
register: rclone_timestamp
@@ -349,7 +354,11 @@
349354

350355
# If rclone_timestamp is blank (would happen if settings.yml was not at destination), default the naming of files to '/archived/old/filename.ext', else /archived/date/filename.ext.
351356
- name: "Archive previous files in '{{ rclone.destination }}'"
352-
shell: "rclone moveto '{{ rclone.destination }}/{{ item }}' '{{ rclone.destination }}/archived/{{ rclone_timestamp.stdout | default('old', true) }}/{{ item }}' 2>/dev/null"
357+
shell: |
358+
/usr/bin/rclone moveto \
359+
--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36' \
360+
'{{ rclone.destination }}/{{ item }}' '{{ rclone.destination }}/archived/{{ (rclone_timestamp.stdout) if (rclone_timestamp is defined) else 'old' }}/{{ item }}' \
361+
2>/dev/null
353362
become: yes
354363
become_user: "{{ user }}"
355364
register: rclone_move
@@ -372,7 +381,15 @@
372381
timeout: 5
373382

374383
- name: "Use rclone to upload backup to '{{ rclone.destination }}'"
375-
command: "rclone copy '{{ local.destination }}' '{{ rclone.destination }}' --stats=30s -v --transfers=4 --drive-chunk-size=128M --log-file='/home/{{ user }}/logs/backup/cloudbox_backup_rclone.log'"
384+
shell: |
385+
/usr/bin/rclone copy \
386+
--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36' \
387+
--transfers=4 \
388+
--drive-chunk-size=128M \
389+
--stats=30s \
390+
-v \
391+
--log-file='/home/{{ user }}/logs/backup/cloudbox_backup_rclone.log' \
392+
'{{ local.destination }}' '{{ rclone.destination }}'
376393
become: yes
377394
become_user: "{{ user }}"
378395
when: (rclone.enable)
@@ -438,6 +455,7 @@
438455
- name: Snapshot | Delete btrfs snapshot
439456
command: "btrfs subvolume delete /btrfs/snapshots/root"
440457
when: (use_snapshot) and (snapshot_type == 'btrfs')
458+
ignore_errors: yes
441459

442460
- name: Start plexdrive and containers
443461
block:

0 commit comments

Comments
 (0)