summaryrefslogtreecommitdiff
path: root/baserock_webserver/instance-hastebin-config.yml
blob: 5447981c1e34da3a561fbab368b052d3ae595875 (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
# Instance-specific configuration for the BuildStream Gitlab IRC bot
---
- hosts: webserver
  vars:
  - haste_server_url: https://github.com/palvarez89/haste-server
  - haste_server_branch: baserock
  - haste_server_install_location: /home/hastebin/haste-server
  - haste_server_service_name: haste-server
  tasks:
  - name: Install Git
    dnf: name=git state=latest
    become: yes

  - name: Install Redis
    dnf: name=redis state=latest
    become: yes

  - name: Start Redis service
    service:
        name: redis
        enabled: yes
        state: started
    become: yes

  - name: Install Node.js
    dnf: name=nodejs state=latest
    become: yes

  - name: hastebin user
    user: name=hastebin
    become: yes
    become_user: root

  - name: Download hastebin sources
    git:
      repo: "{{ haste_server_url }}"
      version: "{{ haste_server_branch }}"
      dest: "{{ haste_server_install_location }}"
    become: yes
    become_user: hastebin

  - name: Update packages based on package.json to their latest version.
    npm:
      path: "{{ haste_server_install_location }}"
      state: latest
    become: yes
    become_user: hastebin

  - name: Install service for the haste server
    template: src=hastebin/haste-server.service.in dest=/etc/systemd/system/{{ haste_server_service_name }}.service
    become: yes

  - name: Restart haste service
    service:
        name: "{{ haste_server_service_name }}"
        enabled: yes
        state: restarted
    become: yes