get restic path from environment
This commit is contained in:
		@@ -8,7 +8,9 @@ error_exit() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
 | 
					RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
 | 
				
			||||||
RESTIC_PATH=${RESTIC_PATH:-/usr/local/bin/restic}
 | 
					
 | 
				
			||||||
 | 
					# shellcheck source=/dev/null
 | 
				
			||||||
 | 
					source "${RESTIC_ETC_PATH}/env.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAX_ATTEMPTS=60
 | 
					MAX_ATTEMPTS=60
 | 
				
			||||||
NICE="ionice -c2 nice -n19"
 | 
					NICE="ionice -c2 nice -n19"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,9 @@ error_exit() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
 | 
					RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
 | 
				
			||||||
RESTIC_PATH=${RESTIC_PATH:-/usr/local/bin/restic}
 | 
					
 | 
				
			||||||
 | 
					# shellcheck source=/dev/null
 | 
				
			||||||
 | 
					source "${RESTIC_ETC_PATH}/env.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ $# -lt 2 ]; then
 | 
					if [ $# -lt 2 ]; then
 | 
				
			||||||
    error_exit "missing arguments"
 | 
					    error_exit "missing arguments"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,9 @@ error_exit() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
 | 
					RESTIC_ETC_PATH=${RESTIC_ETC_PATH:-/etc/restic}
 | 
				
			||||||
RESTIC_PATH=${RESTIC_PATH:-/usr/local/bin/restic}
 | 
					
 | 
				
			||||||
 | 
					# shellcheck source=/dev/null
 | 
				
			||||||
 | 
					source "${RESTIC_ETC_PATH}/env.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$RESTIC_SELF_UPDATE" -eq 1 ]; then
 | 
					if [ "$RESTIC_SELF_UPDATE" -eq 1 ]; then
 | 
				
			||||||
  printf "running restic self-update\n"
 | 
					  printf "running restic self-update\n"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,6 +65,14 @@
 | 
				
			|||||||
    - "{{ restic_etc_path }}/repos"
 | 
					    - "{{ restic_etc_path }}/repos"
 | 
				
			||||||
    - "{{ restic_etc_path }}/jobs"
 | 
					    - "{{ restic_etc_path }}/jobs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: create environment helper
 | 
				
			||||||
 | 
					  template:
 | 
				
			||||||
 | 
					    src: env.sh.j2
 | 
				
			||||||
 | 
					    dest: "{{ restic_etc_path }}/env.sh"
 | 
				
			||||||
 | 
					    owner: root
 | 
				
			||||||
 | 
					    group: root
 | 
				
			||||||
 | 
					    mode: 0400
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: copy restic helper scripts
 | 
					- name: copy restic helper scripts
 | 
				
			||||||
  copy:
 | 
					  copy:
 | 
				
			||||||
    src: "{{ item }}"
 | 
					    src: "{{ item }}"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										7
									
								
								roles/restic/templates/env.sh.j2
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								roles/restic/templates/env.sh.j2
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# {{ ansible_managed }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RESTIC_ETC_PATH="{{ restic_etc_path | default('/etc/restic') }}"
 | 
				
			||||||
 | 
					RESTIC_PATH="{{ restic_path | default('/usr/local/bin/restic') }}"
 | 
				
			||||||
 | 
					RESTIC_SELF_UPDATE={{ restic_self_update | ternary(1, 0) }}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user