From 35276b551dc2cc75dfcf076fe366629c7e944c7a Mon Sep 17 00:00:00 2001 From: micxer Date: Sat, 18 May 2024 14:39:04 +0200 Subject: [PATCH 1/3] feat: Make autorestic configuration file path configurable This commit updates the autorestic configuration file path to use the `autorestic_config_file` variable instead of hardcoding `~/.autorestic.yml`. This change allows for greater flexibility and customization in specifying the location of the configuration file. --- README.md | 8 +++++++- defaults/main.yml | 1 + tasks/main.yml | 6 +++--- tasks/removal.yml | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e4a9b67..a9c3e83 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,13 @@ autorestic_config: B2_ACCOUNT_KEY: Key ``` -The autorestic YAML configuration to be placed into the `~/.autorestic.yml` file. See the [autorestic documentation](https://autorestic.vercel.app/config) for details on the YAML configuration. +See the [autorestic documentation](https://autorestic.vercel.app/config) for details on the YAML configuration. + +```yaml +autorestic_config_file: ~/.autorestic.yml +``` + +The autorestic YAML configuration to be placed into the `~/.autorestic.yml` file. ```yaml autorestic_info: false diff --git a/defaults/main.yml b/defaults/main.yml index 821cc0d..685a068 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,6 +21,7 @@ autorestic_config: env: B2_ACCOUNT_ID: ID B2_ACCOUNT_KEY: Key +autorestic_config_file: ~/.autorestic.yml autorestic_info: false autorestic_check: false autorestic_cron: false diff --git a/tasks/main.yml b/tasks/main.yml index 5c9c708..4914a5a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -48,7 +48,7 @@ - name: Create autorestic configuration file ansible.builtin.copy: content: "{{ autorestic_config | to_yaml }}" - dest: ~/.autorestic.yml + dest: "{{ autorestic_config_file }}" mode: "0600" - name: Run autorestic info @@ -79,7 +79,7 @@ minute: "*/5" job: | {% if autorestic_cron_verbose == true %} - autorestic -c ~/.autorestic.yml --ci cron -vvvvv > /tmp/autorestic.log 2>&1 + autorestic -c {{ autorestic_config_file }} --ci cron -vvvvv > /tmp/autorestic.log 2>&1 {% else %} - autorestic -c ~/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1 + autorestic -c {{ autorestic_config_file }} --ci cron > /tmp/autorestic.log 2>&1 {% endif %} diff --git a/tasks/removal.yml b/tasks/removal.yml index 57ad6ea..ac5d1d1 100644 --- a/tasks/removal.yml +++ b/tasks/removal.yml @@ -11,7 +11,7 @@ - name: Remove autorestic configuration file ansible.builtin.file: - path: ~/.autorestic.yml + path: "{{ autorestic_config_file }}" state: absent - name: Remove restic binary @@ -37,5 +37,5 @@ ansible.builtin.cron: name: Configure autorestic crontab job minute: "*/5" - job: autorestic -c ~/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1 + job: autorestic -c {{ autorestic_config_file }} --ci cron > /tmp/autorestic.log 2>&1 state: absent From 8a83a384758d63eaff2e7181326a39a0bd1321d5 Mon Sep 17 00:00:00 2001 From: micxer Date: Sat, 18 May 2024 17:17:24 +0200 Subject: [PATCH 2/3] chore: Use latest versions of GitHub Actions This commit updates the GitHub Actions workflow file to use version v24 of ansible/ansible-lint instead of the archived version v6 ansible/ansible-lint-action. Also it update the action/checkout to v4. --- .github/workflows/ansible-lint.yml | 4 ++-- .github/workflows/ansible-release.yml | 6 +++--- .github/workflows/molecule.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index 2e5bb10..b411cbf 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Run ansible-lint - uses: ansible-community/ansible-lint-action@v6 + uses: ansible/ansible-lint@v24 diff --git a/.github/workflows/ansible-release.yml b/.github/workflows/ansible-release.yml index 397b4c8..fb2cde9 100644 --- a/.github/workflows/ansible-release.yml +++ b/.github/workflows/ansible-release.yml @@ -12,7 +12,7 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: path: "dbrennand.autorestic" @@ -22,9 +22,9 @@ jobs: - id: role_name run: echo "::set-output name=role_name::$(yq -r '.galaxy_info.role_name' meta/main.yml)" - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - run: pip3 install ansible-core diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 8786af3..6b8d07d 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -9,7 +9,7 @@ jobs: molecule: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: path: dbrennand.autorestic - uses: gofrolist/molecule-action@v2 From a99ef269e283f41008239f8680564d88dc44105a Mon Sep 17 00:00:00 2001 From: dbrennand <52419383+dbrennand@users.noreply.github.com> Date: Sat, 18 May 2024 17:42:10 +0100 Subject: [PATCH 3/3] docs: add new contributor --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a9c3e83..9c625f1 100644 --- a/README.md +++ b/README.md @@ -131,3 +131,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) for [**PleaseStopAsking**](https://github.com/PleaseStopAsking) - *Contributor* [**markstos**](https://github.com/markstos) - *Contributor* + +[**micxer**](https://github.com/micxer) - *Contributor*