Fixes#143 and #164.
- Fix incorrect timer reference in borgmatic.service.j2
(backup_normal_repo.timer -> borgmatic.timer)
- Add borgmatic_timer_enabled variable (default: true) to control
whether the systemd timer is enabled after installation
- Simplify timer management logic in noauto_create_timer_systemd.yml
Previously, the timer was always created but never enabled, causing
users to think backups were running when they weren't. Now the timer
is enabled by default. Users who need manual control can set
borgmatic_timer_enabled: false.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
After an OS upgrade, the Python version may change but the existing
virtualenv at /opt/borgmatic still references the old Python binary.
This causes ModuleNotFoundError when trying to run borgmatic.
This fix adds checks before venv creation to:
1. Get the system's current Python version
2. Check the Python version in the existing venv (if any)
3. Remove the venv if versions don't match, allowing it to be recreated
Fixes#113🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add when conditions to skip SSH key generation and borgmatic config
creation when corresponding variables are empty. This allows users
to install only borg/borgmatic without configuring them.
Closes#188#152
Co-Authored-By: Leonidas Avdelas <avdelasleonidas@gmail.com>
- Rename templates to version-based naming (config_1.7.yaml.j2)
- Use command module instead of shell for version detection
- Add check_mode: false for version detection task
- Fix deprecated remote_rate_limit → upload_rate_limit for 1.8+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- fix truthy values to proper booleans
- fix too long lines: wrapped
- fix indentation
- fix amount of preceding whitespace
- fix argument_spec syntax: borg_retention_policy as type dict with specific options
* `cron` isn't always installed and is not required when using a systemd
timer, so make sure setup doesn't fail when we check if there's
already an installed cron timer
Signed-off-by: Woomymy <woomy@woomy.be>
* Fix failing on EPEL check in Fedora
Only applies when using the "package" install method.
Added a separate variable "borg_require_epel" to make it easy to disable
the check in any other situations (e.g. using a custom mirror instead of
the epel-release package).
* Explain default value of borg_require_epel
* add full path
* Update Readme.me: reorder optional Arguments, update cron -> systemd timer
* remove ssh_key_file; change cron to timer
* Removed cronie from package installation because systemd timer is used
* docker.sh - Stops all or selected containers to save the persistent data intact. The containers are started in reverse order
* Created arguments_specs.yml
* Role restructured:
- if needed creation of a service user incl. creation of the ssh-key,
- add the ssh key to authorized_keys,
- auto init of the repos,
- creation and start of systemd timer and services and
- installation of the Docker helperscript.
* restructure role add import logic
* cleanup: user backup_user
* - "borg_source_directories" is not longer a required Argument
- add "borg_keys_directory" to load key from Service user during starting borgmatic by sudo
* Add borgmatic_initialization_repo (bool) as option to disable init of repo
* cleanup
* fix ansible-lint errors and warnings
* fix letter turner
* add option: borgmatic_timer
* add:
- borgmatic_timer_systemd: true
readd:
- borgmatic_cron_name: "borgmatic"
* - renamed borgmatic_cron_name to borgmatic_timer_cron_name to be more convergent.
- Change recommendations implemented by m3nu so that creation of a timer (systemd or cron) is optional and can be selected via borgmatic_timer.
* Add description to borgmatic_timer_cron_name and borgmatic_timer
* Add variable borg_cron_package to install the cron-packages in case of using timer: cron
* reworked timer install logic
* reworked timer install logic
* Add comments for running backup with service account
* add new parameters for tests
* Switch created to perform the backup as root or service account. If a service account is to be used, it will be created.
* Refactored: Check for ssh-key if not present, genereate them.
* Refactored
* Refactored
* renamed tasks/03_configure.yml to tasks/04_create_links_to_borg_and_borgmatic.yml
* Refactored
* Refactored
* add example for service account
* Update Python version for testing
* No auto init
* Add description to install_backup
* Add description to install_backup
* set coverage back to: m3nu.ansible_role_borgbackup
* The initialization of the repository must be activated and does not take place automatically.
* The initialization of the repository must be activated and does not take place automatically.
* Removed install_backup as var (bool) to prevent that this role run
* Rename backup_ssh_command to borg_ssh_command, tis was a double definition
* Renamed backup_repository to borg_repository and add better explanations
* remove copy ssh-keys and cert parts
* Add comments to borg_ssh_key_file and borg_ssh_key_type
* Set allways the borg_ssh_key_file and borg_ssh_command to load the right ssh-key. Add borg_ssh_key_type to select the key type by user
* Add borg_ssh_key_type
* renamed id_rsa to backup
* generate ssh-keys (backup and backup.pub) and add better explanation
* Print out key if borgmatic_initialization_repo is false
* Remove 'su - {{ borgbackup_user }} -c' to execute the borgmatic by the right user
* Add Check frequency, therefore, we no longer need to distinguish between normal and large repos
* Add link to Article
* renamed backup_ssh_command and backup_ssh_key_file to borg_ssh_command and borg_ssh_key_file
* Removed: borgmatic_initialization_repo
* Removed: borgmatic_initialization_repo
* Removed: borgmatic_initialization_repo
* revert changes
* Add Full Automation
* polishing
* rename backup.timer and bakup.service to borgmatic.timer and borgmatic.service
* remove debug
* Try to find services in ansible_facts
* Forgot to install Cron
* change borg_ssh_key_type to ed25519
* remove conditional checks
* - add hint to using a service user
- renamed: borg_ssh_key_file to borg_ssh_key_file_path
- removed advanced example
* add borg_ssh_key_name, renamed borg_ssh_key_file to borg_ssh_key_file_path
* removed static pointing to ~/.ssh/backup SSH private key
* Add README-Advanced-Examples.md for storing more examples
* Fix test idempotence
* Dont symlink when using distro packages
* Remove old test targets, consistent wording, remove tag
* Remove helper scripts, fix absolute path
* Fix cron job, add assert to prevent duplicate timers
* nit-pick
* Create bin links as root, no borg_ssh_command by default.
* Add breaking changes note to README
---------
Co-authored-by: Manu <manu@snapdragon.cc>
* allow to installation via os package manager or pip
* Run a second time to install via package manager
* Check for EPEL if distro package requested.
* Split dep lists to avoid installing build deps when using distro pkg
Co-authored-by: Stefan Morgenthaler <dev@morgenthaler.at>
Co-authored-by: Manu <manu@snapdragon.cc>
* Add specific package lists for Fedora.
The python packages have been renamed in Fedora 32 (python3-* -> python-*).
To further support Fedora 31, the RedHat vars have been copied for this case.
* Enable molecule tests for Fedora.
* Load vars and tasks by OS family instaed of package manager. Fix Dockerfile for CentOS 8.
* Config for CentOS 8 and others
* Make monthly repo checking the default
I already had an existing SSH key, with a different name. I wanted to be
able to use this one instead of creating another key, potentially used
for another server.