forked from debops/ansible-tinc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Persistent config on Qubes OS using
debops.persistent_paths
- Loading branch information
Showing
9 changed files
with
192 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
debops.tinc - Configure tinc mesh VPN network | ||
|
||
Copyright (C) 2015-2016 Maciej Delmanowski <[email protected]> | ||
Copyright (C) 2016 Robin Schneider <[email protected]> | ||
Copyright (C) 2015-2016 DebOps https://debops.org/ | ||
Copyright (C) 2015-2017 Maciej Delmanowski <[email protected]> | ||
Copyright (C) 2016-2017 Robin Schneider <[email protected]> | ||
Copyright (C) 2015-2017 DebOps https://debops.org/ | ||
|
||
This Ansible role is part of DebOps. | ||
|
||
|
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 |
---|---|---|
|
@@ -159,6 +159,20 @@ tinc__systemd: '{{ True | |
if (ansible_service_mgr|d("unknown") == "systemd") | ||
else False }}' | ||
|
||
# ]]] | ||
# .. envvar:: tinc__persistent_prefix_path [[[ | ||
# | ||
# Directory path prefix which should be used for writing/updating of files made | ||
# persistent by :envvar:`tinc__persistent_paths__dependent_paths`. | ||
tinc__persistent_prefix_path: '{{ ansible_local.persistent_paths.storage_path|d("") | ||
if (ansible_local|d() and | ||
ansible_local.tinc|d() and | ||
ansible_local.tinc.enabled|d() | bool and | ||
ansible_local.persistent_paths|d() and | ||
ansible_local.persistent_paths.enabled|d() | bool and | ||
ansible_local.persistent_paths.write_to_storage_path|d() | bool) | ||
else "" }}' | ||
|
||
# ]]] | ||
# .. envvar:: tinc__vcs_ignore_patterns [[[ | ||
# | ||
|
@@ -301,6 +315,35 @@ tinc__etc_services__dependent_list: '{{ lookup("template", | |
tinc__ferm__dependent_rules: '{{ lookup("template", | ||
"lookup/tinc__ferm__dependent_rules.j2", | ||
convert_data=False) | from_yaml }}' | ||
|
||
# ]]] | ||
# .. envvar:: tinc__persistent_paths__dependent_paths [[[ | ||
# | ||
# Configuration for the debops.persistent_paths_ Ansible role. | ||
tinc__persistent_paths__dependent_paths: | ||
|
||
'50_debops_tinc': | ||
by_role: 'debops.tinc' | ||
paths: | | ||
{{ [ | ||
'/etc/tinc', | ||
'/etc/systemd/system/tinc.service', | ||
'/etc/systemd/system/[email protected]', | ||
'/etc/systemd/system/multi-user.target.wants/tinc.service', | ||
] + ((ansible_local.tinc.networks.keys() | map("regex_replace", "^", "/etc/default/tinc-") | list) | ||
if (ansible_local|d() and ansible_local.tinc|d() and | ||
ansible_local.tinc.networks|d()) | ||
else []) | ||
}} | ||
## Note that when the same network gets deleted and then added again to | ||
## `tinc__combined_networks`, the role might need two runs to also update | ||
## the defaults file in the persistent location. | ||
## '/etc/systemd/system/multi-user.target.wants/tinc.service': | ||
## Note that bind-dirs in Qubes OS currently does not restore symlinks (only their destination). | ||
## This works for ypid_ as he does not want auto start on Qubes OS AppVMs anyway. | ||
## If you need it on Qubes OS, feel free to discuss and patch bind-dirs. | ||
# ]]] | ||
# ]]] | ||
# ]]] |
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,37 @@ | ||
--- | ||
|
||
- name: Configure Tinc VPN and ensure persistence | ||
hosts: [ 'debops_service_tinc_persistent_paths', 'debops_service_tinc_aux' ] | ||
become: True | ||
|
||
environment: '{{ inventory__environment | d({}) | ||
| combine(inventory__group_environment | d({})) | ||
| combine(inventory__host_environment | d({})) }}' | ||
|
||
roles: | ||
|
||
- role: debops.tinc/env | ||
tags: [ 'role::tinc', 'role::tinc:secret', 'role::secret', 'role::ferm' ] | ||
|
||
- role: debops.secret | ||
tags: [ 'role::secret', 'role::tinc:secret' ] | ||
secret_directories: '{{ tinc__env_secret__directories }}' | ||
|
||
- role: debops.apt_preferences | ||
tags: [ 'role::apt_preferences' ] | ||
apt_preferences__dependent_list: '{{ tinc__apt_preferences__dependent_list }}' | ||
|
||
- role: debops.etc_services | ||
tags: [ 'role::etc_services' ] | ||
etc_services__dependent_list: '{{ tinc__env_etc_services__dependent_list }}' | ||
|
||
- role: debops.ferm | ||
tags: [ 'role::ferm' ] | ||
ferm__dependent_rules: '{{ tinc__env_ferm__dependent_rules }}' | ||
|
||
- role: debops.tinc | ||
tags: [ 'role::tinc' ] | ||
|
||
- role: debops.persistent_paths | ||
tags: [ 'role::persistent_paths' ] | ||
persistent_paths__dependent_paths: '{{ tinc__persistent_paths__dependent_paths }}' |
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 @@ | ||
--- | ||
|
||
- name: Configure Tinc VPN | ||
hosts: [ 'debops_service_tinc', 'debops_service_tinc_aux' ] | ||
become: True | ||
|
||
environment: '{{ inventory__environment | d({}) | ||
| combine(inventory__group_environment | d({})) | ||
| combine(inventory__host_environment | d({})) }}' | ||
|
||
roles: | ||
|
||
- role: debops.tinc/env | ||
tags: [ 'role::tinc', 'role::tinc:secret', 'role::secret', 'role::ferm' ] | ||
|
||
- role: debops.secret | ||
tags: [ 'role::secret', 'role::tinc:secret' ] | ||
secret_directories: '{{ tinc__env_secret__directories }}' | ||
|
||
- role: debops.apt_preferences | ||
tags: [ 'role::apt_preferences' ] | ||
apt_preferences__dependent_list: '{{ tinc__apt_preferences__dependent_list }}' | ||
|
||
- role: debops.etc_services | ||
tags: [ 'role::etc_services' ] | ||
etc_services__dependent_list: '{{ tinc__env_etc_services__dependent_list }}' | ||
|
||
- role: debops.ferm | ||
tags: [ 'role::ferm' ] | ||
ferm__dependent_rules: '{{ tinc__env_ferm__dependent_rules }}' | ||
|
||
- role: debops.tinc | ||
tags: [ 'role::tinc' ] |
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,33 +1,5 @@ | ||
--- | ||
|
||
- name: Configure Tinc VPN | ||
hosts: [ 'debops_service_tinc', 'debops_service_tinc_aux' ] | ||
become: True | ||
- include: tinc-plain.yml | ||
|
||
environment: '{{ inventory__environment | d({}) | ||
| combine(inventory__group_environment | d({})) | ||
| combine(inventory__host_environment | d({})) }}' | ||
|
||
roles: | ||
|
||
- role: debops.tinc/env | ||
tags: [ 'role::tinc', 'role::tinc:secret', 'role::secret', 'role::ferm' ] | ||
|
||
- role: debops.secret | ||
tags: [ 'role::secret', 'role::tinc:secret' ] | ||
secret_directories: '{{ tinc__env_secret__directories }}' | ||
|
||
- role: debops.apt_preferences | ||
tags: [ 'role::apt_preferences' ] | ||
apt_preferences__dependent_list: '{{ tinc__apt_preferences__dependent_list }}' | ||
|
||
- role: debops.etc_services | ||
tags: [ 'role::etc_services' ] | ||
etc_services__dependent_list: '{{ tinc__env_etc_services__dependent_list }}' | ||
|
||
- role: debops.ferm | ||
tags: [ 'role::ferm' ] | ||
ferm__dependent_rules: '{{ tinc__env_ferm__dependent_rules }}' | ||
|
||
- role: debops.tinc | ||
tags: [ 'role::tinc' ] | ||
- include: tinc-persistent_paths.yml |
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,4 @@ | ||
{{ ({ | ||
"enabled": True, | ||
"networks": tinc__combined_networks, | ||
}) | to_nice_json }} |