You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
2.8 KiB
136 lines
2.8 KiB
- name: install dependencies
|
|
include_tasks: tasks/install_packages.yml
|
|
vars:
|
|
package:
|
|
- nodejs
|
|
- npm
|
|
- iputils
|
|
- sqlite
|
|
- sqlite-dev
|
|
- python3
|
|
- py3-cryptography
|
|
- py3-pip
|
|
- py3-six
|
|
- py3-yaml
|
|
- py3-click
|
|
- py3-markdown
|
|
- py3-requests
|
|
- py3-requests-oauthlib
|
|
|
|
|
|
- name: install pip dependencies
|
|
pip:
|
|
name: apprise==0.9.7
|
|
|
|
|
|
- name: create user and group
|
|
include_tasks: tasks/create_user.yml
|
|
vars:
|
|
user:
|
|
name: "{{ uptime_kuma_user }}"
|
|
group: "{{ uptime_kuma_group }}"
|
|
dir: "{{ uptime_kuma_dir }}"
|
|
comment: "uptime-kuma service user"
|
|
notify: restart uptime-kuma
|
|
|
|
|
|
- name: get and extract latest version of uptime-kuma sources
|
|
include_tasks: tasks/get_lastversion.yml
|
|
vars:
|
|
package:
|
|
name: louislam/uptime-kuma
|
|
location: github
|
|
sources: yes
|
|
file: "{{ uptime_kuma_dir }}/last_version"
|
|
extract: "{{ uptime_kuma_dir }}"
|
|
user: "{{ uptime_kuma_user }}"
|
|
group: "{{ uptime_kuma_group }}"
|
|
notify: restart uptime-kuma
|
|
strip_first_dir: yes
|
|
|
|
|
|
- name: get and extract latest version of uptime-kuma assets
|
|
include_tasks: tasks/get_lastversion.yml
|
|
vars:
|
|
package:
|
|
name: louislam/uptime-kuma
|
|
location: github
|
|
assets: yes
|
|
asset_filter: '.tar.gz$'
|
|
extract: "{{ uptime_kuma_dir }}"
|
|
user: "{{ uptime_kuma_user }}"
|
|
group: "{{ uptime_kuma_group }}"
|
|
notify: restart uptime-kuma
|
|
force_download: yes
|
|
when: package_changed | d(false) == true
|
|
|
|
|
|
- name: ensure server script has executable bit set
|
|
file:
|
|
path: "{{ uptime_kuma_dir }}/server/server.js"
|
|
mode: "+x"
|
|
|
|
|
|
- name: install sqlite3
|
|
npm:
|
|
path: "{{ uptime_kuma_dir }}"
|
|
name: sqlite3
|
|
production: yes
|
|
become: yes
|
|
become_user: "{{ uptime_kuma_user }}"
|
|
become_method: su
|
|
become_flags: '-s /bin/ash'
|
|
changed_when: no
|
|
|
|
|
|
- name: install npm dependencies
|
|
npm:
|
|
path: "{{ uptime_kuma_dir }}"
|
|
no_optional: yes
|
|
ignore_scripts: yes
|
|
production: yes
|
|
become: yes
|
|
become_user: "{{ uptime_kuma_user }}"
|
|
become_method: su
|
|
become_flags: '-s /bin/ash'
|
|
notify: restart uptime-kuma
|
|
changed_when: no
|
|
|
|
|
|
- name: template init script
|
|
template:
|
|
src: init.j2
|
|
dest: /etc/init.d/uptime-kuma
|
|
force: yes
|
|
mode: "+x"
|
|
notify: restart uptime-kuma
|
|
|
|
|
|
- name: install and configure nginx
|
|
include_role:
|
|
name: nginx
|
|
vars:
|
|
nginx:
|
|
servers:
|
|
- conf: nginx_server
|
|
certs: "{{ host_tls }}"
|
|
|
|
|
|
- name: flush handlers
|
|
meta: flush_handlers
|
|
|
|
|
|
- name: add directories to backup plan
|
|
include_role:
|
|
name: backup
|
|
vars:
|
|
function: add
|
|
backup_items:
|
|
- "{{ uptime_kuma_dir }}"
|
|
|
|
|
|
- name: enable and start uptime-kuma
|
|
service:
|
|
name: uptime-kuma
|
|
enabled: yes
|
|
state: started
|
|
|