-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create a password and add fake gce_credentials to source environment
- Loading branch information
Showing
5 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
--- | ||
# defaults file for restic | ||
restic_user: "restic" | ||
restice_user_home: "/home/{{ restic_user }}" | ||
restic_home: "{{ restic_user_home }}/.restic" | ||
restic_local_repo: "/var/local/demo_backup" | ||
restic_remote_repo: "gs:deadbeef:daily" | ||
restic_gce_credentials: "{{ restic_home }}/pul-gcdc-33c75c1ceece.json" | ||
restic_password: "CHANGEME" | ||
restic_password_file: "{{ restic_user_home }}/.restic.pwd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
--- | ||
# tasks file for restic | ||
- name: Install Restic Software | ||
ansible.builtin.apt: | ||
name: restic | ||
state: present | ||
|
||
- name: Create restic directory if it does not exist | ||
ansible.builtin.file: | ||
path: "{{ restic_home }}" | ||
state: directory | ||
mode: o-rwx | ||
|
||
- name: Add restic credentials | ||
ansible.builtin.template: | ||
src: restic.pwd.j2 | ||
dest: "{{ restic_user_home }}/.restic.pwd" | ||
owner: "{{ restic_user }}" | ||
group: "{{ restic_user }}" | ||
mode: o-r | ||
|
||
- name: Add restic environment | ||
ansible.builtin.template: | ||
src: env.restic.j2 | ||
dest: "{{ restic_user_home }}/.env.restic" | ||
owner: "{{ restic_user }}" | ||
group: "{{ restic_user }}" | ||
mode: o-rwx | ||
|
||
- name: Source Restic environment | ||
ansible.builtin.shell: "source ~/.env.restic" | ||
changed_when: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### repository on local filesystem | ||
export RESTIC_ARCHIVE_REPOSITORY='{{ restic_local_repo }}' | ||
|
||
### repository on google cloud | ||
export GOOGLE_APPLICATION_CREDENTIALS='{{ restic_gce_credentials }}' | ||
|
||
export RESTIC_ARCHIVE_REPOSITORY='{{ restic_remote_repo }}' | ||
|
||
export RESTIC_REPOSITORY=$RESTIC_ARCHIVE_REPOSITORY | ||
export RESTIC_PASSWORD_FILE='{{ restic_password_file }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"{{ restic_password }}" |