From 04b8fa79941dd5a58430a668ad498d62a63460c5 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 20 Nov 2020 16:14:48 +0100 Subject: [PATCH] cleanup some stuff and prepare improvement --- .editorconfig | 12 --- CHANGELOG.md | 19 ---- CONTRIBUTING.md | 50 ---------- HISTORY.md | 97 ------------------- README.md | 6 +- defaults/main.yml | 2 +- molecule/default/molecule.yml | 26 ----- molecule/default/playbook.yml | 59 ----------- molecule/default/test_restic/tasks/main.yml | 9 -- .../test_restic/tasks/test_access_files.yml | 18 ---- .../test_restic/tasks/test_backup_files.yml | 27 ------ .../test_restic/tasks/test_restic_link.yml | 9 -- molecule/default/verify.yml | 8 -- package.json | 5 - tasks/distribution/Linux.yml | 10 +- 15 files changed, 9 insertions(+), 348 deletions(-) delete mode 100644 .editorconfig delete mode 100644 CHANGELOG.md delete mode 100644 CONTRIBUTING.md delete mode 100644 HISTORY.md delete mode 100644 molecule/default/molecule.yml delete mode 100644 molecule/default/playbook.yml delete mode 100644 molecule/default/test_restic/tasks/main.yml delete mode 100644 molecule/default/test_restic/tasks/test_access_files.yml delete mode 100644 molecule/default/test_restic/tasks/test_backup_files.yml delete mode 100644 molecule/default/test_restic/tasks/test_restic_link.yml delete mode 100644 molecule/default/verify.yml delete mode 100644 package.json diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 4a7ea30..0000000 --- a/.editorconfig +++ /dev/null @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 98d100e..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,19 +0,0 @@ - -> @ changelog /Users/mleutenegger/Desktop/Syntro/Ansible/ansible.restic -> git-chglog 0.2.8.. - - -## [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)) - - - -## [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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index a1137a5..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -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` diff --git a/HISTORY.md b/HISTORY.md deleted file mode 100644 index 1e89da2..0000000 --- a/HISTORY.md +++ /dev/null @@ -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 diff --git a/README.md b/README.md index eb81acf..8b0033e 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ ansible-galaxy install arillso.restic | `restic_install_path` | `'/usr/local/bin'` | Install location for the restic binary | | `restic_script_dir` | `'~/restic'` | Location of the generated backup scripts | | `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_dir_owner` | `'{{ansible_user}}'` | The owner of all created dirs | | `restic_dir_group` | `'{{ansible_user}}'` | The group of all created dirs | @@ -156,7 +156,7 @@ Available variables: Example: ```yaml -restic_backups: +restic_archiver__backups: data: name: data repo: remove @@ -165,7 +165,7 @@ restic_backups: 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 > namint the access and backup files diff --git a/defaults/main.yml b/defaults/main.yml index 2be548e..afd7d5b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,7 +6,7 @@ restic_download_path: '/opt/restic' restic_install_path: '/usr/bin' restic_script_dir: '~/restic' restic_repos: {} -restic_backups: [] +restic_archiver__backups: [] restic_create_cron: false restic_dir_owner: '{{ ansible_user | default(ansible_user_id) }}' diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml deleted file mode 100644 index d8c54b7..0000000 --- a/molecule/default/molecule.yml +++ /dev/null @@ -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 diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml deleted file mode 100644 index a3db77a..0000000 --- a/molecule/default/playbook.yml +++ /dev/null @@ -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 diff --git a/molecule/default/test_restic/tasks/main.yml b/molecule/default/test_restic/tasks/main.yml deleted file mode 100644 index 21e1674..0000000 --- a/molecule/default/test_restic/tasks/main.yml +++ /dev/null @@ -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" diff --git a/molecule/default/test_restic/tasks/test_access_files.yml b/molecule/default/test_restic/tasks/test_access_files.yml deleted file mode 100644 index 5698647..0000000 --- a/molecule/default/test_restic/tasks/test_access_files.yml +++ /dev/null @@ -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 diff --git a/molecule/default/test_restic/tasks/test_backup_files.yml b/molecule/default/test_restic/tasks/test_backup_files.yml deleted file mode 100644 index fc22c65..0000000 --- a/molecule/default/test_restic/tasks/test_backup_files.yml +++ /dev/null @@ -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 diff --git a/molecule/default/test_restic/tasks/test_restic_link.yml b/molecule/default/test_restic/tasks/test_restic_link.yml deleted file mode 100644 index e6808c9..0000000 --- a/molecule/default/test_restic/tasks/test_restic_link.yml +++ /dev/null @@ -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 diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml deleted file mode 100644 index b468d1f..0000000 --- a/molecule/default/verify.yml +++ /dev/null @@ -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" diff --git a/package.json b/package.json deleted file mode 100644 index d6613d3..0000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "scripts": { - "changelog": "git-chglog 0.2.8.." - } -} diff --git a/tasks/distribution/Linux.yml b/tasks/distribution/Linux.yml index fe49ca7..77a91b1 100644 --- a/tasks/distribution/Linux.yml +++ b/tasks/distribution/Linux.yml @@ -3,9 +3,9 @@ - name: reformat dict if necessary set_fact: - restic_backups: "{{ restic_backups|dict2items|json_query('[*].value') }}" + restic_archiver__backups: "{{ restic_archiver__backups|dict2items|json_query('[*].value') }}" when: - - restic_backups | type_debug == "dict" + - restic_archiver__backups | type_debug == "dict" - name: Create backup credentials template: @@ -15,7 +15,7 @@ owner: '{{ restic_dir_owner }}' group: '{{ restic_dir_group }}' no_log: true - with_items: '{{ restic_backups }}' + with_items: '{{ restic_archiver__backups }}' when: - item.name is defined - item.src is defined or item.stdin is defined @@ -30,7 +30,7 @@ owner: '{{ restic_dir_owner }}' group: '{{ restic_dir_group }}' no_log: true - with_items: '{{ restic_backups }}' + with_items: '{{ restic_archiver__backups }}' when: - item.name is defined - item.src is defined or item.stdin is defined @@ -49,7 +49,7 @@ state: present become: true no_log: true - with_items: '{{ restic_backups }}' + with_items: '{{ restic_archiver__backups }}' when: - restic_create_cron - item.name is defined