homelab/roles/tor/tasks/main.yml

50 lines
1.1 KiB
YAML
Raw Normal View History

---
- name: Create tor directories
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: "1700"
owner: 100
loop:
- /etc/tor
- /var/lib/tor
- /var/lib/tor/mastodon
- name: Copy tor config
become: true
ansible.builtin.template:
src: torrc.j2
dest: /etc/tor/torrc
owner: 100
mode: "0600"
register: torrc
- name: Copy tor files
become: true
ansible.builtin.copy:
src: "{{ item }}"
dest: /var/lib/tor/{{ item }}
owner: 100
mode: "0600"
loop:
- mastodon/hostname
- mastodon/hs_ed25519_public_key
- mastodon/hs_ed25519_secret_key
register: tor_files
- name: Create tor network
become: true
community.docker.docker_network:
name: tor
- name: Run tor container
become: true
community.docker.docker_container:
name: tor
image: git.comfycamp.space/lumin/homelab-tor:v0.0.2
networks:
- name: tor
2024-10-15 00:24:44 +05:00
- name: haproxy
volumes:
- /etc/tor:/etc/tor:ro
- /var/lib/tor:/var/lib/tor
restart_policy: unless-stopped
recreate: "{{ torrc.changed or tor_files.changed }}"