--- - name: (tor.yml) Ensure tor is installed. apt: name: - tor state: present when: - ansible_os_family == "Debian" tags: - tor-service - name: (tor.yml) Ensure tor servive is enabled and started service: name: tor enabled: yes state: started tags: - tor-service - name: (tor.yml) Adjust configuration /etc/tor/torrc using template torrc.j2 template: src: etc/tor/torrc.j2 dest: '{{ torrc_path }}' owner: root group: root mode: '0644' notify: "Restart tor service" when: - torrc_path is defined tags: - tor-service