lavenderguitar
3 years ago
4 changed files with 110 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||
--- |
|||
- name: kuma | Setup kuma |
|||
command: npm run setup |
|||
args: |
|||
chdir: "{{ kuma__path }}" |
|||
become_user: "{{ kuma__user }}" |
|||
|
|||
- name: kuma | Clear all pm2 apps |
|||
command: pm2 delete all |
|||
args: |
|||
chdir: "{{ kuma__path }}" |
|||
become_user: "{{ kuma__user }}" |
|||
|
|||
- name: kuma | 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 }} |
|||
args: |
|||
chdir: "{{ kuma__path }}" |
|||
become: yes |
|||
become_user: "{{ kuma__user }}" |
|||
|
|||
- name: kuma | Start kuma |
|||
command: pm2 start server/server.js --name kuma |
|||
args: |
|||
chdir: "{{ kuma__path }}" |
|||
become_user: "{{ kuma__user }}" |
|||
|
|||
- name: kuma | Ensure pm2 startup configuration is enabled for reboots. |
|||
command: pm2 save |
|||
args: |
|||
chdir: "{{ kuma__path }}" |
|||
become_user: "{{ kuma__user }}" |
@ -0,0 +1,39 @@ |
|||
--- |
|||
- name: uptime_kuma | dependencies | Install app dependencies |
|||
apt: |
|||
name: "{{ item }}" |
|||
state: present |
|||
update_cache: yes |
|||
loop: |
|||
- curl |
|||
- git |
|||
become: yes |
|||
|
|||
- block: |
|||
- name: uptime_kuma | nodejs | add NodeSource apt key |
|||
apt_key: |
|||
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" |
|||
state: present |
|||
become: yes |
|||
|
|||
- name: uptime_kuma | nodejs | Add NodeSource repository |
|||
apt_repository: |
|||
repo: deb https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main |
|||
state: present |
|||
filename: 'nodesource' |
|||
become: yes |
|||
|
|||
- name: uptime_kuma | nodejs | Add NodeSource src repository |
|||
apt_repository: |
|||
repo: deb-src https://deb.nodesource.com/node_{{ nodejs__version }} {{ ansible_distribution_release }} main |
|||
state: present |
|||
filename: 'nodesource' |
|||
become: yes |
|||
|
|||
- name: uptime_kuma | nodejs | Install NodeJS |
|||
apt: |
|||
name: nodejs |
|||
state: latest |
|||
update-cache: yes |
|||
become: yes |
|||
when: kuma__install_nodejs == true |
@ -0,0 +1,36 @@ |
|||
--- |
|||
- name: uptime_kuma | add_user | Ensure kuma group exists |
|||
group: |
|||
name: "{{ kuma__group }}" |
|||
state: present |
|||
|
|||
- name: uptime_kuma | add_user | Add kuma user |
|||
user: |
|||
name: "{{ kuma__user }}" |
|||
group: "{{ kuma__group }}" |
|||
state: present |
|||
create_home: yes |
|||
shell: /bin/bash |
|||
become: yes |
|||
|
|||
- name: kuma | Clone kuma repo |
|||
git: |
|||
repo: "{{ kuma__repo }}" |
|||
dest: "{{ kuma__path }}" |
|||
owner: "{{ kuma__user }}" |
|||
group: "{{ kuma__group }}" |
|||
become: yes |
|||
|
|||
- name: kuma | Install package dependencies |
|||
npm: |
|||
path: "{{ kuma__path }}" |
|||
state: present |
|||
become_user: "{{ kuma__user }}" |
|||
|
|||
- name: kuma | Install pm2 |
|||
npm: |
|||
name: pm2 |
|||
state: present |
|||
path: "{{ kuma__path }}" |
|||
become: yes |
|||
become_user: "{{ kuma__user }}" |
@ -0,0 +1,4 @@ |
|||
--- |
|||
- include_tasks: dependencies.yml |
|||
- include_tasks: install.yml |
|||
- include_tasks: configure.yml |
Loading…
Reference in new issue