Skip to content

Commit 0aec640

Browse files
better default settings for lftp
1 parent d06e7b9 commit 0aec640

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

roles/backup/defaults/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ backup_remote_password: ''
3838
backup_lftp_mirror_options: '--reverse --continue --delete --no-perms --verbose'
3939

4040
# has to end with ;
41-
backup_lftp_pre_commands: 'set ssl:verify-certificate false;'
41+
# Timeout and connection settings to handle unstable network connections.
42+
# See: https://lftp.yar.ru/lftp-man.html (section SETTINGS)
43+
# - net:timeout: abort operation if no data transfer (default: 5m = 300s)
44+
# - net:reconnect-interval-base: wait time before reconnecting (default: 15s)
45+
# - net:max-retries: retry failed operations (default: 1000)
46+
# - mirror:parallel-transfer-count: parallel file transfers (default: 0 = auto)
47+
# - dns:order: prefer IPv4 over IPv6 to avoid IPv6 routing issues (default: "inet6 inet")
48+
backup_lftp_pre_commands: 'set ssl:verify-certificate false; set net:timeout 300; set net:reconnect-interval-base 30; set net:max-retries 5; set mirror:parallel-transfer-count 1; set dns:order "inet";'
4249

4350
# Uncompressed SQL files (.sql) as well as bzip2 (.bz2), gzip (.gz) and xz
4451
# (at the moment only used for mysql dumps)

roles/backup/tasks/lftp.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
ansible.builtin.command: lftp -c "{{ backup_lftp_pre_commands }} open -u {{ backup_remote_user }},{{ backup_remote_password }} {{ backup_remote_host }}; mirror {{ backup_lftp_mirror_options }} {{ backup_dir }} {{ backup_remote_dir }}"
1818
register: lftp_result
1919
changed_when: "'Transferring file' in lftp_result.stdout or 'Removing old file' in lftp_result.stdout"
20+
retries: 3
21+
delay: 60
22+
until: lftp_result.rc == 0
2023

2124
- name: Output of lftp sync
2225
ansible.builtin.debug:

0 commit comments

Comments
 (0)