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

remove custom installation path #53

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: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
| `restic_user` | "root" | system user to run restic |
| `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_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
3 changes: 0 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ restic_version: '0.9.4'
restic_user: root
restic_group: "{{ restic_user }}"
restic_shell: "/bin/false"
restic_home: "/var/lib/restic"

restic_install_path: '/usr/local/bin'

restic_initialize_repos: true

Expand Down
1 change: 0 additions & 1 deletion molecule/alternative/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
vars:
restic_user: restic
restic_group: restic
restic_install_path: "/opt"
restic_initialize_repos: false
restic_repos:
- name: s3-example
Expand Down
2 changes: 1 addition & 1 deletion molecule/alternative/tests/test_alternative.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def test_binary(host):
binary = host.file("/opt/restic")
binary = host.file("/usr/local/bin/restic")
assert binary.exists
assert binary.is_file
assert binary.mode == 0o750
Expand Down
4 changes: 2 additions & 2 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- name: Deploy helper commands
template:
src: 'restic.helper.j2'
dest: "{{ restic_install_path }}/restic-{{ item.name }}"
dest: "{{ _restic_install_path }}/restic-{{ item.name }}"
owner: "{{ restic_user }}"
group: "{{ restic_group }}"
mode: '0750'
Expand All @@ -29,7 +29,7 @@
when: restic_user != 'root'

- name: Initialize restic repositories
command: "{{ restic_install_path }}/restic-{{ item.name }} init"
command: "{{ _restic_install_path }}/restic-{{ item.name }} init"
ignore_errors: true
no_log: true
with_items: "{{ restic_repos }}"
Expand Down
9 changes: 2 additions & 7 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
shell: "{{ restic_shell }}"
system: true
createhome: true
home: "{{ restic_home }}"
home: "{{ _restic_home }}"
state: present
when: restic_user != 'root'

- name: Ensure restic installation directory exist
file:
state: 'directory'
path: '{{ restic_install_path }}'

- name: Ensure restic user can write to log dirs if defined
file:
state: 'directory'
Expand Down Expand Up @@ -83,7 +78,7 @@

- name: Set proper capabilities for restic binary
capabilities:
path: '{{ restic_install_path }}/restic'
path: '{{ _restic_install_path }}/restic'
capability: cap_dac_read_search+ep
state: present
when:
Expand Down
2 changes: 1 addition & 1 deletion templates/restic.cron.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ ansible_managed | comment }}
MAILTO="{{ restic_cron_mailto }}"
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:{{ restic_install_path }}
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:{{ _restic_install_path }}
RESTIC_REPOSITORY={{ item.url | trim | quote }}
RESTIC_PASSWORD={{ item.password | trim | quote }}
{% if item.remote_credentials is defined %}
Expand Down
2 changes: 1 addition & 1 deletion templates/restic.helper.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# vi: ft=jinja.crontab
{{ ansible_managed | comment }}
(
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:{{ restic_install_path }}
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:{{ _restic_install_path }}
export PATH
RESTIC_REPOSITORY={{ item.url | trim | quote }}
export RESTIC_REPOSITORY
Expand Down
2 changes: 2 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ go_arch_map:
armv6l: arm

go_arch: "{{ go_arch_map[ansible_architecture] | default(ansible_architecture) }}"
_restic_home: "/var/lib/restic"
_restic_install_path: '/usr/local/bin'