aboutsummaryrefslogtreecommitdiff
path: root/roles/searxng/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/searxng/tasks')
-rw-r--r--roles/searxng/tasks/main.yml84
1 files changed, 84 insertions, 0 deletions
diff --git a/roles/searxng/tasks/main.yml b/roles/searxng/tasks/main.yml
new file mode 100644
index 0000000..c7d45d4
--- /dev/null
+++ b/roles/searxng/tasks/main.yml
@@ -0,0 +1,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