summaryrefslogtreecommitdiff
path: root/roles/tor/tasks/main.yml
blob: 5aa1076426c9f9a4cbb335058ca4fba4f113491e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- name: Install tor
  ansible.builtin.package:
    name:
      - tor
    state: present

- name: Create /etc/torrc.d for drop-in tor configs
  ansible.builtin.file:
    path: /etc/torrc.d
    state: directory
    owner: root
    group: root
    mode: u+rw,g+r,o+r

- name: Allow usage of drop-in configs from /etc/torrc.d
  ansible.builtin.lineinfile:
    dest: /etc/tor/torrc
    state: present
    regexp: '^(#)?%include /etc/torrc.d/\*.conf'
    line: '%include /etc/torrc.d/*.conf'
    owner: root
    group: root
    mode: u+rw,g+r,o+r
  notify:
    - Reload tor

- name: Configure tor middlebox
  ansible.builtin.copy:
    src: files/middlebox.conf
    dest: /etc/torrc.d/middlebox.conf
    owner: root
    group: root
    mode: u+rw,g+r,o+r
  notify:
    - Reload tor

- name: Enable tor systemd service
  ansible.builtin.service:
    name: tor
    enabled: yes
    state: started