jameslavender 3 years ago
parent
commit
38d6f4c7e3
  1. 48
      tasks/configure.yml
  2. 10
      tasks/dependencies.yml
  3. 11
      tasks/install.yml

48
tasks/configure.yml

@ -1,31 +1,29 @@
--- ---
- name: kuma | Setup kuma - block:
command: npm run setup - name: uptime_kuma | configure | Setup kuma
args: command: npm run setup
chdir: "{{ kuma__path }}" args:
become_user: "{{ kuma__user }}" chdir: "{{ kuma__path }}"
- name: kuma | Clear all pm2 apps - name: uptime_kuma | configure | Clear all pm2 apps
command: pm2 delete all command: pm2 delete all
args: args:
chdir: "{{ kuma__path }}" chdir: "{{ kuma__path }}"
become_user: "{{ kuma__user }}"
- name: kuma | Create systemd startup script - name: uptime_kuma | configure | Create systemd startup script
command: env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u {{ kuma__user }} --hp /home/{{ kuma__user }} command: env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u {{ kuma__user }} --hp /home/{{ kuma__user }}
args: args:
chdir: "{{ kuma__path }}" chdir: "{{ kuma__path }}"
become: yes become: yes
become_user: "{{ kuma__user }}"
- name: kuma | Start kuma - name: uptime_kuma | configure | Start kuma
command: pm2 start server/server.js --name kuma command: pm2 start server/server.js --name kuma
args: args:
chdir: "{{ kuma__path }}" chdir: "{{ kuma__path }}"
become_user: "{{ kuma__user }}"
- name: kuma | Ensure pm2 startup configuration is enabled for reboots. - name: uptime_kuma | configure | Ensure pm2 startup configuration is enabled for reboots.
command: pm2 save command: pm2 save
args: args:
chdir: "{{ kuma__path }}" chdir: "{{ kuma__path }}"
become_user: "{{ kuma__user }}" become_user: "{{ kuma__user }}"
become: yes

10
tasks/dependencies.yml

@ -10,30 +10,30 @@
become: yes become: yes
- block: - block:
- name: uptime_kuma | nodejs | add NodeSource apt key - name: uptime_kuma | dependencies | nodejs | add NodeSource apt key
apt_key: apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
state: present state: present
become: yes become: yes
- name: uptime_kuma | nodejs | Add NodeSource repository - name: uptime_kuma | dependencies | nodejs | Add NodeSource repository
apt_repository: apt_repository:
repo: deb https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main repo: deb https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main
state: present state: present
filename: 'nodesource' filename: 'nodesource'
become: yes become: yes
- name: uptime_kuma | nodejs | Add NodeSource src repository - name: uptime_kuma | dependencies | nodejs | Add NodeSource src repository
apt_repository: apt_repository:
repo: deb-src https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main repo: deb-src https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main
state: present state: present
filename: 'nodesource' filename: 'nodesource'
become: yes become: yes
- name: uptime_kuma | nodejs | Install NodeJS - name: uptime_kuma | dependencies | nodejs | Install NodeJS
apt: apt:
name: nodejs name: nodejs
state: latest state: latest
update-cache: yes update-cache: yes
become: yes become: yes
when: kuma__install_nodejs == true when: kuma__install_nodejs | bool

11
tasks/install.yml

@ -1,10 +1,10 @@
--- ---
- name: uptime_kuma | add_user | Ensure kuma group exists - name: uptime_kuma | install | add_user | Ensure kuma group exists
group: group:
name: "{{ kuma__group }}" name: "{{ kuma__group }}"
state: present state: present
- name: uptime_kuma | add_user | Add kuma user - name: uptime_kuma | install | add_user | Add kuma user
user: user:
name: "{{ kuma__user }}" name: "{{ kuma__user }}"
group: "{{ kuma__group }}" group: "{{ kuma__group }}"
@ -13,7 +13,7 @@
shell: /bin/bash shell: /bin/bash
become: yes become: yes
- name: kuma | Clone kuma repo - name: uptime_kuma | install | Clone kuma repo
git: git:
repo: "{{ kuma__repo }}" repo: "{{ kuma__repo }}"
dest: "{{ kuma__path }}" dest: "{{ kuma__path }}"
@ -21,13 +21,14 @@
group: "{{ kuma__group }}" group: "{{ kuma__group }}"
become: yes become: yes
- name: kuma | Install package dependencies - name: uptime_kuma | install | Install package dependencies
npm: npm:
path: "{{ kuma__path }}" path: "{{ kuma__path }}"
state: present state: present
become: yes
become_user: "{{ kuma__user }}" become_user: "{{ kuma__user }}"
- name: kuma | Install pm2 - name: uptime_kuma | install | Install pm2
npm: npm:
name: pm2 name: pm2
state: present state: present

Loading…
Cancel
Save