some minor features and fixes for ansible role

This commit is contained in:
Muhammed Hussein Karimi 2021-12-14 01:14:44 +03:30
parent f05651d235
commit 2c0e22ad31
6 changed files with 20 additions and 8 deletions

View file

@ -15,8 +15,8 @@ I will try to make this readme better
3. prepare inventory hosts
4. put your certificates in files section in nginx role with this structure below:
```
ansible -> roles -> nginx -> ssl -> <uptime kuma domain>.fullchain.pem
ansible -> roles -> nginx -> ssl -> <uptime kuma domain>.privkey.pem
ansible -> roles -> nginx -> files -> ssl -> <uptime kuma domain>.fullchain.pem
ansible -> roles -> nginx -> files -> ssl -> <uptime kuma domain>.privkey.pem
```
5. to run playbook
```bash
@ -25,7 +25,14 @@ ansible-playbook ./playbook.yml -i <your inventory path> -e "kuma_domain=<uptime
you can use other ansible playbook options too
> Note: Replace `<uptime kuma domain>` with your desired domain for uptime kuma
> replace `<version>` with a version from https://github.com/louislam/uptime-kuma/releases
> replace `<alpine or debian>` with one of options
> `-e "kuma_image_os=<alpine or debian>" -e "kuma_image_version=<version>"` is not required and you can remove this part or change only one of them (kuma_image_os is debian & kuma_image_version is 1 by default)
> If you are not using root user as your ansible_user use -bK option to become root
> instead of `-e "kuma_image_os=<alpine or debian>" -e "kuma_image_version=<version>"` You can use `-e kuma_tag=<uptime kuma full tag>` and replace `<uptime kuma full tag>` with your desired tag (e.g. `latest`)
> you can also create a yaml file with variables that you want to set & use it (also: ansible-vars)

View file

@ -6,9 +6,14 @@
- name: docker
docker_compose_version: "v2.0.1"
tasks:
- name: Ensure {{inventory_hostname}} is set as hostname
hostname:
name: "{{inventory_hostname}}"
tags: ["hostname"]
roles:
- {role: geerlingguy.docker, tags: ["docker"]}
- {role: geerlingguy.pip, tags: ["docker"]}
- {role: kuma, tags: ["kuma"]}
- {role: uptime-kuma, tags: ["kuma"]}
- {role: nginx, tags: ["nginx"]}

View file

@ -8,10 +8,10 @@
- /compose/volumes/nginx
- /compose/volumes/nginx/log/{{ kuma_domain }}
- name: Ensure nginx config directory exist
- name: Ensure nginx SSL certificates exist
copy:
src: ssl
dest: /compose/volumes/nginx/ssl
dest: /compose/volumes/nginx
mode: 'preserve'
group: root
owner: root

View file

@ -1,3 +1,4 @@
---
kuma_image_version: '1'
kuma_image_os: 'debian'
kuma_tag: "{{kuma_image_version}}-{{kuma_image_os}}"

View file

@ -20,4 +20,3 @@
state: present
project_src: /compose/kuma
pull: yes

View file

@ -9,7 +9,7 @@ services:
volumes:
- '/compose/volumes/uptime-kuma:/app/data'
container_name: uptime-kuma
image: 'louislam/uptime-kuma:{{kuma_image_version}}-{{kuma_image_os}}'
image: 'louislam/uptime-kuma:{{kuma_tag}}'
nginx:
ports: