feat: a lots of stuff and bugfixes mostly

This commit is contained in:
Albatroz Jeremias 2026-09-23 00:12:31 +01:00
parent 0289360eb6
commit a13235a7db
14 changed files with 468 additions and 62 deletions

52
tasks/certbot.yml Normal file
View file

@ -0,0 +1,52 @@
---
- name: "check if cert {{ cuyper__gateway_hostname }} exists"
stat:
path: "{{ cuyper__cuyper_storage_path }}/letsencrypt/live/{{ cuyper__gateway_hostname }}/fullchain.pem"
register: fullchainpem
- name: "create nginx without ssl /hooks (cuyper) /portainer on {{ cuyper__cuyper_storage_path }}/nginx/nginx-hooks.conf"
ansible.builtin.template:
src: templates/nginx-hooks.conf.j2
dest: "{{ cuyper__cuyper_config_path }}/nginx/nginx-hooks.conf"
when: cuyper__cuyper_ssl != "yes" or not fullchainpem.stat.exists
- name: "setting as absent / deleting {{ cuyper__cuyper_storage_path }}/nginx/nginx-hooks-ssl.conf"
ansible.builtin.file:
path: "{{ cuyper__cuyper_config_path }}/nginx/nginx-hooks-ssl.conf"
state: absent
when: cuyper__cuyper_ssl != "yes" or not fullchainpem.stat.exists
- name: Restart loabalancer
community.docker.docker_compose_v2:
project_src: "{{ cuyper__cuyper_instance_path }}"
state: restarted
register: output
when: cuyper__cuyper_ssl == "yes" and not fullchainpem.stat.exists
- name: Run a simple command (argv)
community.docker.docker_compose_v2_run:
service: loadbalancer
argv:
- certbot
- "-d"
- "{{ cuyper__hostname }}"
- "--agree-tos"
- "--non-interactive"
- "--nginx"
chdir: "{{ cuyper__cuyper_instance_path }}"
project_src: "{{ cuyper__cuyper_instance_path }}"
register: result
when: cuyper__cuyper_ssl == "yes" and not fullchainpem.stat.exists
- name: "create nginx w ssl /hooks (cuyper) /portainer on {{ cuyper__cuyper_storage_path }}/nginx/nginx-hooks-ssl.conf"
ansible.builtin.template:
src: templates/nginx-hooks-ssl.conf.j2
dest: "{{ cuyper__cuyper_config_path }}/nginx/nginx-hooks-ssl.conf"
when: cuyper__cuyper_ssl == "yes" and fullchainpem.stat.exists
- name: "setting as absent / deleting {{ cuyper__cuyper_storage_path }}/nginx/nginx-hooks.conf"
ansible.builtin.file:
path: "{{ cuyper__cuyper_config_path }}/nginx/nginx-hooks.conf"
state: absent
when: cuyper__cuyper_ssl == "yes" and fullchainpem.stat.exists