summaryrefslogtreecommitdiff
path: root/install-uptime-kuma-playbook.yml
blob: 76c6e1bb6378e89b4cb15364e28bc1284c7e7ffe (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
---
- name: Set up Uptime Kuma on all servers
  hosts: hosts
  remote_user: root
  tasks:
    - name: Install Needed Packages
      ansible.builtin.apt: 
        update_cache: yes
        pkg:
          - nginx
          - curl
          - git
    - name: Install NodeJS Source
      ansible.builtin.shell: 'curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt'
    - name: Install NodeJS
      ansible.builtin.apt:
        update_cache: yes
        name: nodejs
    - name: Clone Uptime Kuma
      ansible.builtin.shell: 'cd /root/ && git clone https://github.com/louislam/uptime-kuma.git'
    - name: Run NPM Commands
      ansible.builtin.shell: 'cd /root/uptime-kuma/ && npm run setup && npm install pm2 -g'
    - name: Install logrotate
      ansible.builtin.shell: 'cd /root/uptime-kuma/ && pm2 install pm2-logrotate'
    - name: Start Kuma Server
      ansible.builtin.shell: 'cd /root/uptime-kuma/ && pm2 start server/server.js --name uptime-kuma && pm2 startup'
    - name: NGINX Config
      become: true
      ansible.builtin.copy:
        src: 'files/uptime-kuma.conf'
        dest: /etc/nginx/conf.d/uptime-kuma.conf
        owner: root
        group: root
        mode: '0644'
    - name: Restart NGINX
      ansible.builtin.systemd_service:
        name: nginx
        state: restarted
        enabled: true