@@ -0,0 +1 @@ | |||||
tor_hidden_services: [] |
@@ -0,0 +1,6 @@ | |||||
--- | |||||
- name: restart tor | |||||
systemd: | |||||
name: tor@default.service | |||||
state: restarted |
@@ -0,0 +1,16 @@ | |||||
--- | |||||
- name: ansible local facts directory | |||||
file: | |||||
path: /etc/ansible/facts.d | |||||
state: directory | |||||
- name: set ansible local fact | |||||
copy: | |||||
content: "{{_local_facts|to_json}}" | |||||
dest: /etc/ansible/facts.d/{{role_name}}.fact | |||||
register: _local_facts_set | |||||
- name: Gathering Facts | |||||
setup: | |||||
when: _local_facts_set.changed |
@@ -0,0 +1,20 @@ | |||||
--- | |||||
- import_tasks: setup_Debian.yaml | |||||
- name: torrc config file | |||||
template: | |||||
src: torrc.j2 | |||||
dest: /etc/tor/torrc | |||||
notify: restart tor | |||||
- name: flush handlers | |||||
meta: flush_handlers | |||||
- name: get tor hidden service hostnames | |||||
command: cat /var/lib/tor/{{item}}/hostname | |||||
loop: "{{ tor_hidden_services | json_query('[*].name') }}" | |||||
register: tor_hidden_services_hostnames_cat | |||||
changed_when: false | |||||
- import_tasks: local_facts.yaml |
@@ -0,0 +1,7 @@ | |||||
--- | |||||
- name: required debian packages | |||||
apt: | |||||
pkg: | |||||
- tor | |||||
- fish |
@@ -0,0 +1,11 @@ | |||||
{{ansible_managed|comment}} | |||||
## hidden services | |||||
{% for ths in tor_hidden_services %} | |||||
# hidden service "{{ths.name}}" | |||||
HiddenServiceDir /var/lib/tor/{{ths.name}}/ | |||||
{% for sp in ths.service_ports %} | |||||
HiddenServicePort {{sp.virtport}} {{sp.target}} | |||||
{% endfor %} | |||||
{% endfor %} |
@@ -0,0 +1,3 @@ | |||||
--- | |||||
_local_facts: | |||||
tor_hidden_services_hostnames: "{{ tor_hidden_services_hostnames_cat | json_query(\"results[*].{key: item, value: stdout}\") | items2dict }}" |