From e297345a34b9332e9b1a093127f71658272c3b2a Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 23 Mar 2021 16:16:20 +0100 Subject: [PATCH 1/4] change how to ged os specific vars --- tasks/main.yml | 23 +---------------------- vars/main.yml | 11 +++++++++++ 2 files changed, 12 insertions(+), 22 deletions(-) create mode 100644 vars/main.yml diff --git a/tasks/main.yml b/tasks/main.yml index 685812e..668200f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,27 +1,6 @@ --- -# tasks file for skeleton - - name: add OS specific variables - include_vars: '{{ loop_vars }}' - with_first_found: - - files: - - '{{ distribution }}-{{ distribution_version }}.yml' - - '{{ distribution }}-{{ distribution_major_version }}.yml' - - '{{ distribution }}.yml' - - '{{ ansible_os_family }}.yml' - - '{{ ansible_system }}.yml' - - 'defaults.yml' - paths: - - 'vars' - loop_control: - loop_var: loop_vars - vars: - distribution: '{{ ansible_distribution }}' - distribution_version: '{{ ansible_distribution_version }}' - distribution_major_version: '{{ ansible_distribution_major_version }}' - tags: - - configuration - - packages + ansible.builtin.include_vars: "{{ lookup('first_found', restic_os_variables) }}" - name: Ensure restic directories exist file: diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..a9c0aa5 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,11 @@ +--- +restic_os_variables: + files: + - '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml' + - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' + - '{{ distribution }}.yml' + - '{{ ansible_os_family }}.yml' + - '{{ ansible_system }}.yml' + - 'defaults.yml' + paths: + - 'vars' From 0aeeb9434e913fa4bc7116342638ae17d7b9cc25 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 23 Mar 2021 16:22:10 +0100 Subject: [PATCH 2/4] Change license link in README and change Author The License link in the README is not reachable. So I added a MIT License to the Repo itself, changed the Link and added the Copyright Persons specified in the README. I also updated the Author to be myself in the Galaxy meta file. --- LICENSE | 22 ++++++++++++++++++++++ README.md | 9 +-------- meta/main.yml | 34 +++++++++++----------------------- 3 files changed, 34 insertions(+), 31 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..770b8d0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2019, Arillso +Copyright (c) 220 L3D + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ae074ad..31de012 100644 --- a/README.md +++ b/README.md @@ -187,14 +187,7 @@ none - restic ``` -## Author - -- Matthias Leutenegger - ## License -This project is under the MIT License. See the [LICENSE](https://sbaerlo.ch/licence) file for the full license text. +This project is under the MIT License. See the [LICENSE](LICENSE) file for the full license text. -## Copyright - -(c) 2019, Arillso diff --git a/meta/main.yml b/meta/main.yml index bd8915d..f2206db 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,33 +1,21 @@ --- galaxy_info: role_name: restic - author: Matthias Leutenegger - description: Role to deploy restic and setup backups. - # company: + author: do1jlr + description: Ansible role to deploy restic and setup backups. license: MIT - min_ansible_version: 2.8 + min_ansible_version: 2.9 platforms: - - name: EL - versions: - - 6 - - 7 - - name: Fedora - versions: - - 29 - - name: Ubuntu - versions: - - bionic - - cosmic - name: Debian - versions: - - jessie - - stretch - - buster - # - name: Windows - # versions: - # - all - + versions: all + - name: EL + versions: all + - name: Fedora + versions: all + - name: Ubuntu + versions: all galaxy_tags: - backup + - restic dependencies: [] From 9dc223b12c9b1995153b7ad252110124b6fdb929 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 23 Mar 2021 16:35:44 +0100 Subject: [PATCH 3/4] improve linting --- .chglog/config.yml | 1 + .github/workflows/galaxy.yml | 16 +++---- .github/workflows/test.yml | 1 + .gitignore | 3 +- .yamllint | 8 ++++ .../test_restic/tasks/test_access_files.yml | 32 ++++++------- .../test_restic/tasks/test_backup_files.yml | 48 +++++++++---------- .../test_restic/tasks/test_restic_link.yml | 16 +++---- 8 files changed, 67 insertions(+), 58 deletions(-) create mode 100644 .yamllint diff --git a/.chglog/config.yml b/.chglog/config.yml index 6b97559..1881dcf 100644 --- a/.chglog/config.yml +++ b/.chglog/config.yml @@ -1,3 +1,4 @@ +--- style: github template: CHANGELOG.tpl.md info: diff --git a/.github/workflows/galaxy.yml b/.github/workflows/galaxy.yml index 93e5a66..b5dc0ec 100644 --- a/.github/workflows/galaxy.yml +++ b/.github/workflows/galaxy.yml @@ -1,22 +1,20 @@ --- -name: 🌌 Galaxy import +name: Galaxy release +# yamllint disable-line rule:truthy on: push: - branches: - - master + branches: ['main'] release: - types: - - published + types: ['created'] jobs: - import: - name: 🚀 Galaxy Action + build: runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v2 - name: galaxy - uses: robertdebock/galaxy-action@1.1.1 + uses: robertdebock/galaxy-action@1.1.0 with: - galaxy_api_key: ${{ secrets.GALAXY_API_KEY }} + galaxy_api_key: ${{ secrets.galaxy_api_key }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 508bb4c..3d4853a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,6 @@ --- name: 🎭 Tests +# yamllint disable-line rule:truthy on: push: paths: diff --git a/.gitignore b/.gitignore index 496ee2c..3bbb019 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.DS_Store \ No newline at end of file +.cache +.DS_Store diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..cb32cb1 --- /dev/null +++ b/.yamllint @@ -0,0 +1,8 @@ +--- +extends: default + +rules: + # 150 chars should be enough, but don't fail if a line is longer + line-length: + max: 150 + level: warning diff --git a/molecule/default/test_restic/tasks/test_access_files.yml b/molecule/default/test_restic/tasks/test_access_files.yml index 5698647..74418f9 100644 --- a/molecule/default/test_restic/tasks/test_access_files.yml +++ b/molecule/default/test_restic/tasks/test_access_files.yml @@ -1,18 +1,18 @@ --- - - 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 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 +- 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 index fc22c65..25c6349 100644 --- a/molecule/default/test_restic/tasks/test_backup_files.yml +++ b/molecule/default/test_restic/tasks/test_backup_files.yml @@ -1,27 +1,27 @@ --- - - 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 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: 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 +- 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 index e6808c9..eba08b2 100644 --- a/molecule/default/test_restic/tasks/test_restic_link.yml +++ b/molecule/default/test_restic/tasks/test_restic_link.yml @@ -1,9 +1,9 @@ --- - - 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 +- 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 From 7140f98ab8331647e7b8eb44bc89347ee1ba1547 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 23 Mar 2021 17:52:31 +0100 Subject: [PATCH 4/4] :%s/distribution/ansible_distribution/gc --- vars/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/main.yml b/vars/main.yml index a9c0aa5..2b8a3bf 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -3,7 +3,7 @@ restic_os_variables: files: - '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml' - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' - - '{{ distribution }}.yml' + - '{{ ansible_distribution }}.yml' - '{{ ansible_os_family }}.yml' - '{{ ansible_system }}.yml' - 'defaults.yml'