Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make autorestic configuration file path configurable #13

Merged
merged 3 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflows/ansible-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
path: "dbrennand.autorestic"

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -125,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*
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 %}
4 changes: 2 additions & 2 deletions tasks/removal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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