main.yml - ansible-roles - A collection of ansible roles I have created over the years.
(HTM) git clone git://jay.scot/ansible-roles
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
main.yml (2177B)
---
1 ---
2 - include_tasks: variables.yml
3
4 - name: Add searx user account.
5 user:
6 name: "{{ searx_user }}"
7 home: "{{ searx_install_path }}"
8 create_home: false
9 register: add_user
10
11 - include_tasks: setup-Debian.yml
12 when: ansible_os_family == 'Debian'
13
14 - include_tasks: setup-RedHat.yml
15 when: ansible_os_family == 'RedHat'
16
17 - name: Git clone searx repo.
18 git:
19 repo: 'https://github.com/asciimoo/searx.git'
20 dest: "{{ searx_install_path }}"
21 version: "{{ searx_release }}"
22 update: false
23 force: false
24 depth: 1
25 register: git_updated
26
27 - name: Install python dependencies.
28 pip:
29 virtualenv: searx-ve
30 virtualenv_site_packages: true
31 requirements: requirements.txt
32 extra_args: '--no-cache-dir'
33 chdir: '{{ searx_install_path }}'
34
35 - name: Generate secret key.
36 command: openssl rand -hex 16
37 register: searx_key
38 when: git_updated.changed
39
40 - name: Update searx secret key.
41 replace:
42 dest: "{{ searx_install_path }}/searx/settings.yml"
43 regexp: ultrasecretkey
44 replace: "{{ searx_key.stdout }}"
45 when: git_updated.changed
46 notify: Restart searx
47
48 - name: Disable searx debugging.
49 replace:
50 dest: "{{ searx_install_path }}/searx/settings.yml"
51 regexp: "debug : True"
52 replace: "debug : False"
53 when: not searx_debug
54 notify: Restart searx
55
56 - name: Enable searx debugging.
57 replace:
58 dest: "{{ searx_install_path }}/searx/settings.yml"
59 regexp: "debug : False"
60 replace: "debug : True"
61 when: searx_debug
62 notify: Restart searx
63
64 - name: Copy searx systemd service template.
65 template:
66 src: searx.service.j2
67 dest: /lib/systemd/system/searx.service
68
69 - name: Enable and start searx service
70 service:
71 name: searx
72 state: started
73 enabled: true
74
75 - name: Copy nginx config.
76 template:
77 src: vhost.conf.j2
78 dest: "{{ nginx_vhost_path }}/vhost_searx.conf"
79 notify: Restart nginx
80
81 - name: Remove default nginx config.
82 file:
83 path: /etc/nginx/sites-enabled/default
84 state: absent
85 when: searx_remove_nginx_default
86 notify: Restart nginx
87
88 - name: Copy uwsgi config.
89 template:
90 src: uwsgi.ini.j2
91 dest: /etc/uwsgi/apps-enabled/searx.ini
92 notify: Restart uwsgi