52 lines
No EOL
2 KiB
YAML
52 lines
No EOL
2 KiB
YAML
---
|
|
- 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 |