Skip to content
This repository has been archived by the owner on Jun 12, 2020. It is now read-only.

Add restic_mode variable #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| `restic_group` | "root" | system group to run restic |
| `restic_shell` | "/bin/false" | the shell for the restic user, change this if you want to be able to su to it |
| `restic_install_path` | "/usr/local/bin" | directory where restic binary will be installed |
| `restic_mode` | 0750 | permissions of the restic binary, change to 0755 if you want to allow all users to run restic |
| `restic_cron_mailto` | restic_user | who to mail results of the restic crons to, set to "" to not mail |
| `restic_cron_stdout_file` | null | what file to log restic output to, null means include in mailto, use /dev/null to discard |
| `restic_cron_stderr_file` | null | what file to log restic errors to, null means include in mailto, use /dev/null to discard |
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ restic_user: root
restic_group: "{{ restic_user }}"
restic_shell: "/bin/false"
restic_home: "/var/lib/restic"
restic_mode: 0750

restic_install_path: '/usr/local/bin'

Expand Down
10 changes: 9 additions & 1 deletion tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@
copy:
src: "/tmp/restic_{{ restic_version }}_{{ go_arch }}"
dest: '{{ restic_install_path }}/restic'
mode: '0750'
mode: '{{ restic_mode }}'
owner: 'root'
group: '{{ restic_group }}'

- name: Read status of restic binary
stat:
path: '{{ restic_install_path }}/restic'
register: restic_binary

- name: Install libcap on Debian systems
apt:
name: "libcap2-bin"
Expand All @@ -80,6 +85,7 @@
when:
- ansible_os_family | lower == "debian"
- restic_user != 'root'
- restic_group != 'root'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheLastProject I think this line is wrong too, right? libcap2-bin should be installed if restic_user OR restic_group are not 'root', like this:

 - restic_user != 'root' or restic_group != 'root'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is @paulfantom's code, but it seems to me that that indeed should be changed.


- name: Set proper capabilities for restic binary
capabilities:
Expand All @@ -88,4 +94,6 @@
state: present
when:
- restic_user != 'root'
- restic_group != 'root'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

- not ansible_check_mode
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheLastProject This does not come from my PR, but still: what is this line for? The tasks are always run when not ansible_check_mode, no? Did I make a mistake in my thinking?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. and skipped when in Check/Test-Mode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just to not fail if the capabilities are not set

- not restic_binary.stat.xoth