-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.yml
53 lines (53 loc) · 1.44 KB
/
main.yml
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
---
- name: Create destination folder for search api
file:
path: "{{ nsfw_server_install_path }}"
state: directory
owner: "{{ lookup('env','USER') }}"
- block:
- name: Clone nsfw-server repository
git:
dest: "{{ nsfw_server_install_path }}"
repo: "{{ nsfw_server_repo }}"
version: "{{ nsfw_server_version }}"
register: source
- name: Install search API
command: npm install --production --no-save
args:
chdir: "{{ nsfw_server_install_path }}"
when: source.changed
notify: "restart {{ nsfw_server_service }}"
- include_role:
name: annotate
vars:
role: api
version: "{{ source.after }}"
action: upgrade
when: source.changed
become: false
- name: Create {{ nsfw_server_group }} group
group:
name: "{{ nsfw_server_group }}"
system: true
state: present
- name: Create {{ nsfw_server_user }} user
user:
name: "{{ nsfw_server_user}}"
comment: nsfw-server
group: "{{ nsfw_server_group }}"
system: true
state: present
shell: /usr/sbin/nologin
# https://github.com/npm/cli/issues/4769
# home: /nonexistent
# create_home: no
- name: Install ipfs-search service
template:
src: nsfw-server.service
dest: "/etc/systemd/system/{{ nsfw_server_service }}.service"
notify: "restart {{ nsfw_server_service }}"
- name: Enable search service
service:
name: "{{ nsfw_server_service }}"
enabled: yes
state: started