-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1451661
commit 12f0bc3
Showing
15 changed files
with
84 additions
and
48 deletions.
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
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
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,4 +1,5 @@ | ||
--- | ||
n8n_exporter_requires_package: "python3-passlib" | ||
n8n_exporter_proxy_basic_auth_username: n8n-exporter | ||
n8n_exporter_nginx_data_dir: "{{ nginx_data_dir }}/proxies" | ||
n8n_exporter_proxy_basic_auth_password: "{{ vault_n8n_exporter_proxy_basic_auth_password }}" |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Restic Exporter role | ||
|
||
Add nginx config for Restic exporter path. | ||
|
||
## Usage | ||
|
||
Configure the role. | ||
|
||
```yml | ||
restic_exporter_requires_package: python2-passlib # default: python3-passlib | ||
restic_exporter_nginx_data_dir: /usr/share/nginx/proxies # default: "{{ nginx_data_dir }}/proxies" | ||
restic_exporter_proxy_basic_auth_username: exporter # default: restic-exporter | ||
restic_exporter_proxy_basic_auth_password: # default: "{{ vault_restic_exporter_proxy_basic_auth_password }}" | ||
``` | ||
Ensure the nginx proxy includes the restic-exporter config: | ||
```yml | ||
nginx_proxies: | ||
- src_hostname: server.example.com | ||
ssl: true | ||
exporter: restic | ||
options: | | ||
include /etc/nginx/conf.d/proxies/restic-exporter.nginx; | ||
``` | ||
Include the role in your playbook. | ||
```yml | ||
- hosts: restic | ||
roles: | ||
- role: restic_exporter | ||
``` |
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,5 @@ | ||
--- | ||
restic_exporter_requires_package: python3-passlib | ||
restic_exporter_nginx_data_dir: "{{ nginx_data_dir }}/proxies" | ||
restic_exporter_proxy_basic_auth_username: restic-exporter | ||
restic_exporter_proxy_basic_auth_password: "{{ vault_restic_exporter_proxy_basic_auth_password }}" |
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,6 @@ | ||
--- | ||
- name: Include {{ role_name }} tasks | ||
ansible.builtin.include_tasks: "{{ role_name }}.yml" | ||
when: restic_server_hostname is defined | ||
tags: | ||
- restic_exporter |
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,25 @@ | ||
--- | ||
- name: Ensure nginx data dir exists | ||
ansible.builtin.file: | ||
path: "{{ restic_exporter_nginx_data_dir }}" | ||
state: directory | ||
|
||
- name: Gather package facts | ||
ansible.builtin.package_facts: | ||
manager: auto | ||
|
||
- name: Fail if package {{ restic_exporter_requires_package }} is not installed | ||
ansible.builtin.fail: | ||
msg: Package {{ restic_exporter_requires_package }} is not installed! | ||
when: restic_exporter_requires_package not in ansible_facts.packages | ||
|
||
- name: Configure user access for {{ role_name }} | ||
community.general.htpasswd: | ||
path: "{{ restic_exporter_nginx_data_dir }}/restic-exporter.htpasswd" | ||
name: "{{ restic_exporter_proxy_basic_auth_username }}" | ||
password: "{{ restic_exporter_proxy_basic_auth_password }}" | ||
|
||
- name: Copy nginx {{ role_name }} conf | ||
ansible.builtin.template: | ||
src: restic-exporter.nginx | ||
dest: "{{ restic_exporter_nginx_data_dir }}/restic-exporter.nginx" |
3 changes: 1 addition & 2 deletions
3
...stic_server/templates/restic-server.nginx → ..._exporter/templates/restic-exporter.nginx
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,7 +1,6 @@ | ||
location /restic-server/ { | ||
auth_basic "{{ restic_server_proxy_basic_auth_username }}"; | ||
auth_basic "{{ restic_exporter_proxy_basic_auth_username }}"; | ||
auth_basic_user_file /etc/nginx/conf.d/proxies/restic-server.htpasswd; | ||
proxy_pass http://{{ restic_server_hostname }}:8000/; | ||
include /etc/nginx/conf.d/proxy-params.conf; | ||
proxy_set_header Authorization "Basic {{ restic_server_basic_auth | string | b64encode }}"; | ||
} |
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,7 +1,5 @@ | ||
--- | ||
restic_server_description: Restic Server | ||
restic_server_requires_package: python3-passlib | ||
restic_server_user: restic | ||
restic_server_description: Restic Server | ||
restic_server_proxy_basic_auth_username: restic-server | ||
restic_server_nginx_data_dir: "{{ nginx_data_dir }}/proxies" | ||
restic_server_basic_auth: "{{ restic_server_user }}:{{ restic_server_password }}" | ||
restic_server_password: "{{ vault_restic_server_password }}" |
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 was deleted.
Oops, something went wrong.