borgbase / ansible-role-borgbackup

Ansible role to set up Borg and Borgmatic
MIT License
229 stars 101 forks source link

Add if around exclude options to prevent yaml error #72

Closed Kogelvis closed 3 years ago

Kogelvis commented 3 years ago

On a new CentOS 7 system without setting the borg_exclude_patterns and borg_exclude_from variables borgmatic will complain about an invalid configuration file:

summary:
/etc/borgmatic/config.yaml: Error parsing configuration file
An error occurred while parsing a configuration file at /etc/borgmatic/config.yaml:
At 'location.exclude_patterns': None is not of type 'array'
At 'location.exclude_from': None is not of type 'array'

This was after deploying and issuing borgmatic -I -e repokey

This change will omit the respective settings when they are empty and thus preventing a configuration error.

m3nu commented 3 years ago

Good catch! Thanks! 🙏 Let's run CI and then merge this.

Kogelvis commented 3 years ago

You're welcome and thanks for merging :slightly_smiling_face: