--- - 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 - /var/lib/tor/peertube - /var/lib/tor/comfycamp - 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 - peertube/hostname - peertube/hs_ed25519_public_key - peertube/hs_ed25519_secret_key - comfycamp/hostname - comfycamp/hs_ed25519_public_key - comfycamp/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 - 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 }}"