summaryrefslogtreecommitdiff
path: root/roles/base/tasks/base_setup.yaml
blob: f1ed062ae1a24772ec57d0b998ea383c54ffd69c (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
- name: "Create vpns user"
  ansible.builtin.user:
    name: _vpn
    create_home: no
    comment: Project VPN user
    state: present
    shell: /sbin/nologin
  notify: restart_notification

- name: "Create root directory of vpn services"
  ansible.builtin.file:
    path: /var/reactance/
    state: directory
    owner: _vpn
    group: _vpn
    mode:  0755

- name: "templating out ip forwarding rules in sysctl.conf"
  ansible.builtin.blockinfile:
    path: /etc/sysctl.conf
    create: true
    backup: true
    marker: "### REACTANCE - IP Forwarding - {mark} ###"
    insertafter: "EOF"
    block: |
      net.inet.ip.forwarding=1
      net.inet6.ip6.forwarding=1

- name: "templating out sysctl.conf"
  ansible.builtin.template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
    mode: '0644'
  notify: syslogd_restart
  loop:
    - src: syslog.conf.j2
      dest: /etc/syslog.conf
    - src: newsyslog.conf.j2
      dest: /etc/newsyslog.conf
    

# openbsd_pkg cant be run parallely otherwise there could be package locks and pipeline would fail
- name: "install necessary utils"
  community.general.openbsd_pkg:
    name:
      - unzip--
      - curl--
      - rsync--
      - jq--
    state: present
  when: inventory_hostname in (groups['vless']|default([]) + groups['vmess']|default([]) + groups['trojan']|default([]) + groups['all_vpns']|default([]))

- name: "tune unbound performance"
  community.general.openbsd_pkg:
    name: ripgrep
    state: present
  when: not disable_dns|default(False)