|
256 | 256 | - name: Snapshot | Delete btrfs snapshot |
257 | 257 | command: "btrfs subvolume delete /btrfs/snapshots/root" |
258 | 258 | when: (use_snapshot) and (snapshot_type == 'btrfs') |
| 259 | + ignore_errors: yes |
259 | 260 |
|
260 | 261 | - name: Check if tar files were created |
261 | 262 | find: |
|
340 | 341 |
|
341 | 342 | # 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. |
342 | 343 | - 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 |
344 | 349 | become: yes |
345 | 350 | become_user: "{{ user }}" |
346 | 351 | register: rclone_timestamp |
|
349 | 354 |
|
350 | 355 | # 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. |
351 | 356 | - 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 |
353 | 362 | become: yes |
354 | 363 | become_user: "{{ user }}" |
355 | 364 | register: rclone_move |
|
372 | 381 | timeout: 5 |
373 | 382 |
|
374 | 383 | - 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 }}' |
376 | 393 | become: yes |
377 | 394 | become_user: "{{ user }}" |
378 | 395 | when: (rclone.enable) |
|
438 | 455 | - name: Snapshot | Delete btrfs snapshot |
439 | 456 | command: "btrfs subvolume delete /btrfs/snapshots/root" |
440 | 457 | when: (use_snapshot) and (snapshot_type == 'btrfs') |
| 458 | + ignore_errors: yes |
441 | 459 |
|
442 | 460 | - name: Start plexdrive and containers |
443 | 461 | block: |
|
0 commit comments