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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
---
- name: Ensure searxng system group exists
ansible.builtin.group:
name: "{{ searxng_group }}"
gid: "{{ searxng_gid }}"
system: true
state: present
- name: Ensure searxng system user exists
ansible.builtin.user:
name: "{{ searxng_user }}"
uid: "{{ searxng_uid }}"
group: "{{ searxng_group }}"
groups: sudo
append: true
comment: "Privacy-respecting metasearch engine"
home: "{{ searxng_home }}"
shell: /bin/bash
system: true
state: present
- name: Ensure SearXNG directories exist
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode }}"
loop:
- { path: "{{ searxng_home }}", owner: "{{ searxng_user }}", group: "{{ searxng_group }}", mode: "0755" }
- { path: "{{ searxng_home }}/.ansible/tmp", owner: "{{ searxng_user }}", group: "{{ searxng_group }}", mode: "0700" }
- { path: "{{ searxng_run_dir }}", owner: "{{ searxng_user }}", group: "{{ searxng_group }}", mode: "0755" }
- { path: "/etc/searxng", owner: "root", group: "root", mode: "0755" }
- { path: "/etc/uwsgi/apps-available", owner: "root", group: "root", mode: "0755" }
- { path: "/etc/uwsgi/apps-enabled", owner: "root", group: "root", mode: "0755" }
- name: Clone or update SearXNG source repository
ansible.builtin.git:
repo: "{{ searxng_git_repo }}"
dest: "{{ searxng_src_dir }}"
version: "{{ searxng_git_version }}"
update: false
become: true
become_user: "{{ searxng_user }}"
- name: Deploy /etc/searxng/settings.yml
ansible.builtin.template:
src: settings.yml.j2
dest: /etc/searxng/settings.yml
owner: "{{ searxng_user }}"
group: "{{ searxng_group }}"
mode: "0640"
notify: Restart uwsgi
- name: Deploy /etc/searxng/limiter.toml
ansible.builtin.template:
src: limiter.toml.j2
dest: /etc/searxng/limiter.toml
owner: "{{ searxng_user }}"
group: "{{ searxng_group }}"
mode: "0644"
notify: Restart uwsgi
- name: Deploy uWSGI app configuration for SearXNG
ansible.builtin.template:
src: uwsgi-searxng.ini.j2
dest: /etc/uwsgi/apps-available/searxng.ini
owner: root
group: root
mode: "0644"
notify: Restart uwsgi
- name: Enable uWSGI SearXNG app symlink
ansible.builtin.file:
src: /etc/uwsgi/apps-available/searxng.ini
dest: /etc/uwsgi/apps-enabled/searxng.ini
state: link
notify: Restart uwsgi
- name: Ensure uwsgi service is enabled and running
ansible.builtin.service:
name: uwsgi
enabled: true
state: started
|