1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic_archiver.git synced 2024-08-16 10:09:49 +02:00

cleanup some stuff and prepare improvement

This commit is contained in:
L3D 2020-11-20 16:14:48 +01:00
parent a075ace31b
commit 04b8fa7994
No known key found for this signature in database
GPG key ID: 5215C3441797AB2B
15 changed files with 9 additions and 348 deletions

View file

@ -1,12 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

View file

@ -1,19 +0,0 @@
> @ changelog /Users/mleutenegger/Desktop/Syntro/Ansible/ansible.restic
> git-chglog 0.2.8..
<a name="unreleased"></a>
## [Unreleased]
### 🍰 Added
- git-chglog
- github workflows ([#25](https://github.com/syntro-opensource/ansible.silverstripe/issues/25))
- example for backup syntax ([#24](https://github.com/syntro-opensource/ansible.silverstripe/issues/24))
<a name="0.2.8"></a>
## [0.2.8] - 2020-09-08
## History
For versions before 0.2.9, see [HISTORY.md](HISTORY.md)
[Unreleased]: https://github.com/syntro-opensource/ansible.silverstripe/compare/0.2.8...HEAD
[0.2.8]: https://github.com/syntro-opensource/ansible.silverstripe/compare/0.2.7...0.2.8

View file

@ -1,50 +0,0 @@
# Contribution Guidelines
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
## Code of Conduct
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## How to Contribute
### Reporting Bugs
To report bugs, please open an issue containing:
* Clear description of the problem
* Messages, log entries etc.
* Example configuration to reproduce the issue
### Suggesting Enhancements
To suggest an enhancement, open an issue containing:
* Clear description of the feature you are suggesting
### Contribute Code
We welcome any contribution of code to this repository, from bugfixes to new
features. In order to simplify code review and speed up the process of adding
new features, please follow the steps below for every single fix / enhancement.
Adding multiple features and fixes to one pull request will lead to more
complicated code review and you risk your changes being declined because of
things that have nothing to do with them.
Follow these steps to contribute code:
1. Open an issue describing what you want to change (follow one of the previous
chapters).
2. Create a fork and implement your changes
3. Open a pull request to `master`

View file

@ -1,97 +0,0 @@
# Changelog
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
and [human-readable changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
## [0.2.8] 2020-09-08
### Added
* Sanity check for restic binary
* Support for the Backblaze B2 backend
## [0.2.7] 2020-08-05
### Added
* Config option to exclude files
* Contributing guide
## [0.2.6] 2020-06-05
### Changed
* Password now use `regex_escape()` filter in templates
## [0.2.5] - 2020-06-02
### Fixed:
* AWS credentials are now supplied to the initialising step
* Cronjob step does not fail if `scheduled` parameter is not set on repo
* init respects `'config already initialized'` string
## [0.2.4] - 2020-06-01
### Added
* `aws_default_region` for repos
## 0.2.3 - 2020-05-18
### Fixed
* extraction path is actually generated
## [0.2.2]
### Changed
* Updated default Restic version to `'0.9.6'`
### Fixed
* Backup scripts use bash (@maciekmm)
* SFTP Link correctly renders in MD
## [0.2.1]
### Fixed
* Crontab entries are now created correctly (@dnmvisser)
* Molecule now correctly runs lint (@mleutenegger)
## [0.2.0]
### Added
* S3 Support
## [0.1.5]
### Changed
* Path generation for `forget` task now checks if `src` is actually filled and not only defined.
### Added
* `prune` option for automatic pruning during forget
## [0.1.4]
### Changed
* `--keep-tags` tags are correctly applied to the forget command
* Backup policies now also check if the respective variable actually contains a value
### Added
* Added a template which only adds credentials for use with `source` on linux distros
## [0.1.3]
### Changed
* Creating script dir before templating out scripts
## [0.1.2]
### Changed
* build sucessfully completes
## [0.1.1]
### Changed
* `restic_url` is now set in defaults
## 0.1.0
### Added
* initial release
[Unreleased]: https://github.com/arillso/ansible.restic/compare/0.2.8...HEAD
[0.2.8]: https://github.com/arillso/ansible.restic/compare/0.2.7...0.2.8
[0.2.7]: https://github.com/arillso/ansible.restic/compare/0.2.6...0.2.7
[0.2.6]: https://github.com/arillso/ansible.restic/compare/0.2.5...0.2.6
[0.2.5]: https://github.com/arillso/ansible.restic/compare/0.2.4...0.2.5
[0.2.4]: https://github.com/arillso/ansible.restic/compare/0.2.3...0.2.4
[0.2.3]: https://github.com/arillso/ansible.restic/compare/0.2.2...0.2.3
[0.2.2]: https://github.com/arillso/ansible.restic/compare/0.2.1...0.2.2
[0.2.1]: https://github.com/arillso/ansible.restic/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/arillso/ansible.restic/compare/0.1.5...0.2.0
[0.1.5]: https://github.com/arillso/ansible.restic/compare/0.1.4...0.1.5
[0.1.4]: https://github.com/arillso/ansible.restic/compare/0.1.3...0.1.4
[0.1.3]: https://github.com/arillso/ansible.restic/compare/0.1.2...0.1.3
[0.1.2]: https://github.com/arillso/ansible.restic/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/arillso/ansible.restic/compare/0.1.0...0.1.1

View file

@ -81,7 +81,7 @@ ansible-galaxy install arillso.restic
| `restic_install_path` | `'/usr/local/bin'` | Install location for the restic binary | | `restic_install_path` | `'/usr/local/bin'` | Install location for the restic binary |
| `restic_script_dir` | `'~/restic'` | Location of the generated backup scripts | | `restic_script_dir` | `'~/restic'` | Location of the generated backup scripts |
| `restic_repos` | `{}` | A dictionary of repositories where snapshots are stored | | `restic_repos` | `{}` | A dictionary of repositories where snapshots are stored |
| `restic_backups` | `{}` (or `[]`) | A list of dictionaries specifying the files and directories to be backed up | | `restic_archiver__backups` | `{}` (or `[]`) | A list of dictionaries specifying the files and directories to be backed up |
| `restic_create_cron` | `false` | Should a cronjob be created for each backup | | `restic_create_cron` | `false` | Should a cronjob be created for each backup |
| `restic_dir_owner` | `'{{ansible_user}}'` | The owner of all created dirs | | `restic_dir_owner` | `'{{ansible_user}}'` | The owner of all created dirs |
| `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs | | `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs |
@ -156,7 +156,7 @@ Available variables:
Example: Example:
```yaml ```yaml
restic_backups: restic_archiver__backups:
data: data:
name: data name: data
repo: remove repo: remove
@ -165,7 +165,7 @@ restic_backups:
schedule_hour: 3 schedule_hour: 3
``` ```
> You can also specify restic_backups as an array, which is a legacy feature and > You can also specify restic_archiver__backups as an array, which is a legacy feature and
> might be deprecated in the future. currently, the name key is used for > might be deprecated in the future. currently, the name key is used for
> namint the access and backup files > namint the access and backup files

View file

@ -6,7 +6,7 @@ restic_download_path: '/opt/restic'
restic_install_path: '/usr/bin' restic_install_path: '/usr/bin'
restic_script_dir: '~/restic' restic_script_dir: '~/restic'
restic_repos: {} restic_repos: {}
restic_backups: [] restic_archiver__backups: []
restic_create_cron: false restic_create_cron: false
restic_dir_owner: '{{ ansible_user | default(ansible_user_id) }}' restic_dir_owner: '{{ ansible_user | default(ansible_user_id) }}'

View file

@ -1,26 +0,0 @@
---
dependency:
name: galaxy
driver:
name: docker
# lint: |
# set -e
# yamllint .
platforms:
- name: instance
image: 'geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest'
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
privileged: true
pre_build_image: true
provisioner:
name: ansible
# lint:
# name: ansible-lint
playbooks:
converge: ${MOLECULE_PLAYBOOK:-playbook.yml}
scenario:
name: default
verifier:
name: ansible

View file

@ -1,59 +0,0 @@
---
- name: Converge
hosts: all
roles:
- role: ansible.restic
pre_tasks:
- name: install bzip2
package:
name: bzip2
state: present
vars:
restic_download_path: ~/restic
restic_install_path: ~/restic
restic_repos:
local:
location: /backup
password: securepassword1
init: true
restic_backups:
- name: test
src: /home
repo: local
keep_last: 4
keep_tag: deployment
- name: test_stdin
repo: local
stdin: true
stdin_cmd: echo "this comes from stdin"
stdin_filename: stdin.txt
keep_last: 2
keep_hourly: 24
keep_daily: 7
keep_monthly: 12
keep_yearly: 5
- name: Converge with dict
hosts: all
roles:
- role: ansible.restic
pre_tasks:
- name: install bzip2
package:
name: bzip2
state: present
vars:
restic_download_path: ~/restic
restic_install_path: ~/restic
restic_repos:
local:
location: /backup
password: securepassword1
init: true
restic_backups:
dicttest:
name: dicttest
src: /home
repo: local
keep_last: 4
keep_tag: deployment

View file

@ -1,9 +0,0 @@
---
- name: "include tasks for testing backup files"
include_tasks: "test_backup_files.yml"
- name: "include tasks for testing access files"
include_tasks: "test_access_files.yml"
- name: "include tasks for testing restic link"
include_tasks: "test_restic_link.yml"

View file

@ -1,18 +0,0 @@
---
- name: Stat test access file
stat:
path: ~/restic/access-test.sh
register: test_file
- name: Check that the test access file exists
assert:
that:
- test_file.stat.exists
- name: Stat test_stdin access file
stat:
path: ~/restic/access-test_stdin.sh
register: test_stdin_file
- name: Check that the test_stdin access file exists
assert:
that:
- test_stdin_file.stat.exists

View file

@ -1,27 +0,0 @@
---
- name: Stat test backup file
stat:
path: ~/restic/backup-test.sh
register: test_file
- name: Check that the test backup file exists
assert:
that:
- test_file.stat.exists
- name: Stat test_stdin backup file
stat:
path: ~/restic/backup-test_stdin.sh
register: test_stdin_file
- name: Check that the test_stdin backup file exists
assert:
that:
- test_stdin_file.stat.exists
- name: Run the backup scripts
shell: "./{{ item }}"
args:
chdir: ~/restic/
with_items:
- backup-dicttest.sh
- backup-test.sh
- backup-test_stdin.sh

View file

@ -1,9 +0,0 @@
---
- name: Stat test restic link
stat:
path: ~/restic/restic
register: restic_link
- name: Check that the test restic link exists
assert:
that:
- restic_link.stat.exists

View file

@ -1,8 +0,0 @@
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
tasks:
- name: "Include test_alpha-services"
include_role:
name: "test_restic"

View file

@ -1,5 +0,0 @@
{
"scripts": {
"changelog": "git-chglog 0.2.8.."
}
}

View file

@ -3,9 +3,9 @@
- name: reformat dict if necessary - name: reformat dict if necessary
set_fact: set_fact:
restic_backups: "{{ restic_backups|dict2items|json_query('[*].value') }}" restic_archiver__backups: "{{ restic_archiver__backups|dict2items|json_query('[*].value') }}"
when: when:
- restic_backups | type_debug == "dict" - restic_archiver__backups | type_debug == "dict"
- name: Create backup credentials - name: Create backup credentials
template: template:
@ -15,7 +15,7 @@
owner: '{{ restic_dir_owner }}' owner: '{{ restic_dir_owner }}'
group: '{{ restic_dir_group }}' group: '{{ restic_dir_group }}'
no_log: true no_log: true
with_items: '{{ restic_backups }}' with_items: '{{ restic_archiver__backups }}'
when: when:
- item.name is defined - item.name is defined
- item.src is defined or item.stdin is defined - item.src is defined or item.stdin is defined
@ -30,7 +30,7 @@
owner: '{{ restic_dir_owner }}' owner: '{{ restic_dir_owner }}'
group: '{{ restic_dir_group }}' group: '{{ restic_dir_group }}'
no_log: true no_log: true
with_items: '{{ restic_backups }}' with_items: '{{ restic_archiver__backups }}'
when: when:
- item.name is defined - item.name is defined
- item.src is defined or item.stdin is defined - item.src is defined or item.stdin is defined
@ -49,7 +49,7 @@
state: present state: present
become: true become: true
no_log: true no_log: true
with_items: '{{ restic_backups }}' with_items: '{{ restic_archiver__backups }}'
when: when:
- restic_create_cron - restic_create_cron
- item.name is defined - item.name is defined