diff --git a/ansible/README.md b/ansible/README.md index ef0e7b03b..51caa13ce 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -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 -> .fullchain.pem -ansible -> roles -> nginx -> ssl -> .privkey.pem +ansible -> roles -> nginx -> files -> ssl -> .fullchain.pem +ansible -> roles -> nginx -> files -> ssl -> .privkey.pem ``` 5. to run playbook ```bash @@ -25,7 +25,14 @@ ansible-playbook ./playbook.yml -i -e "kuma_domain= Note: Replace `` with your desired domain for uptime kuma + > replace `` with a version from https://github.com/louislam/uptime-kuma/releases > replace `` with one of options + > `-e "kuma_image_os=" -e "kuma_image_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=" -e "kuma_image_version="` You can use `-e kuma_tag=` and replace `` 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) diff --git a/ansible/playbook.yml b/ansible/playbook.yml index 3900f77d2..dc21e249f 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -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"]} - diff --git a/ansible/roles/nginx/tasks/main.yml b/ansible/roles/nginx/tasks/main.yml index 25cf89eac..ea0da9a38 100644 --- a/ansible/roles/nginx/tasks/main.yml +++ b/ansible/roles/nginx/tasks/main.yml @@ -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 diff --git a/ansible/roles/uptime-kuma/defaults/main.yml b/ansible/roles/uptime-kuma/defaults/main.yml index 7f2896862..c2f5d1bc1 100644 --- a/ansible/roles/uptime-kuma/defaults/main.yml +++ b/ansible/roles/uptime-kuma/defaults/main.yml @@ -1,3 +1,4 @@ --- kuma_image_version: '1' kuma_image_os: 'debian' +kuma_tag: "{{kuma_image_version}}-{{kuma_image_os}}" diff --git a/ansible/roles/uptime-kuma/tasks/main.yml b/ansible/roles/uptime-kuma/tasks/main.yml index 304bc2919..11893e939 100644 --- a/ansible/roles/uptime-kuma/tasks/main.yml +++ b/ansible/roles/uptime-kuma/tasks/main.yml @@ -20,4 +20,3 @@ state: present project_src: /compose/kuma pull: yes - diff --git a/ansible/roles/uptime-kuma/templates/docker-compose.yml b/ansible/roles/uptime-kuma/templates/docker-compose.yml index 7af4c1cc8..3357bdc69 100644 --- a/ansible/roles/uptime-kuma/templates/docker-compose.yml +++ b/ansible/roles/uptime-kuma/templates/docker-compose.yml @@ -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: