aboutsummaryrefslogtreecommitdiff
path: root/roles/searxng/tasks/main.yaml
blob: 5dbaf6c4df2fbfccf28493c99a5b04f1f8a5ac78 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
# https://docs.searxng.org/admin/installation-docker.html#installation-docker
---

- name: 'Create Searxng data dir'
  file:
    path: '{{ searxng_data_root }}'
    state: 'directory'
    owner: '{{ ansible_user }}'
    group: '{{ ansible_user }}'
    mode: '755'

- name: 'Copy over searxng settings file to data dir'
  template:
    src: 'settings.yaml.j2'
    dest: '{{ searxng_data_root }}/settings.yml'
    owner: '{{ ansible_user }}'
    group: '{{ ansible_user }}'
    mode: '644'
  notify:
    - 'redis_restart'
    - 'searxng_restart'

- name: 'Create the Searxng network'
  community.docker.docker_network:
    name: '{{ searxng_docker_network_name }}'
    ipam_driver: 'default'
    state: 'present'

- name: 'Make sure the Redis container is created and running'
  community.docker.docker_container:
    name: '{{ searxng_redis_container_name }}'
    image: 'redis:alpine'
    command: 'redis-server --save "" --appendonly "no"'
    networks:
      - name: '{{ searxng_docker_network_name }}'
    tmpfs:
      - '/var/lib/redis'
    cap_drop:
      - 'ALL'
    capabilities:
      - 'SETGID'
      - 'SETUID'
      - 'DAC_OVERRIDE'
    state: 'started'
    restart_policy: 'unless-stopped'

- name: 'Make sure the Searxng container is created and running'
  community.docker.docker_container:
    name: 'searxng'
    image: 'searxng/searxng:latest'
    networks:
      - name: '{{ searxng_docker_network_name }}'
    ports:
      - '0.0.0.0:{{ searxng_host_port }}:8080'
    volumes:
      - '{{ searxng_data_root }}/:/etc/searxng:rw'
    env:
      TZ': '{{ searxng_tz }}'
    cap_drop:
      - 'ALL'
    capabilities:
      - 'CHOWN'
      - 'SETGID'
      - 'SETUID'
      - 'DAC_OVERRIDE'
    log_driver: 'json-file'
    log_options:
      max-size: '1m'
      max-file: '1'
    state: 'started'
    restart_policy: 'unless-stopped'