Les onions perso sont idempotents

This commit is contained in:
southerntofu 2020-04-17 19:35:08 +02:00
parent 8b77ef3651
commit 749f80a664
1 changed files with 7 additions and 0 deletions

View File

@ -1,15 +1,22 @@
- stat:
path: "/etc/nginx/sites-available/{{ item.name }}.onion.conf"
register: conf_exists
- name: webserver-onion-hostname
command: "cat /var/lib/tor/{{ item.name }}/hostname"
register: web_onion
when: not conf_exists.stat.exists
- name: webserver-onion-config
template:
src: ../files/onion.conf.j2
dest: "/etc/nginx/sites-available/{{ item.name }}.onion.conf"
notify: reload nginx
when: not conf_exists.stat.exists
- name: webserver-onion-symlink
file:
src: "/etc/nginx/sites-available/{{ item.name }}.onion.conf"
dest: "/etc/nginx/sites-enabled/{{ item.name }}.onion.conf"
state: link
when: not conf_exists.stat.exists