2024-10-27 12:18:58 -03:00

66 lines
2.0 KiB
YAML

- name: dnsmasq role
include_role: name=dnsmasq
tags: dns
- name: knsupdate
include_role: name=knsupdate
tags: knot
- name: certbot role
include_role: name=certbot
tags: certbot
- include_tasks: ../../althost/tasks/compose.yml
vars: # forcing since this role is included statically
service_name: proxy
- name: configuration path
file: path={{ conf_path }} state=directory
# TODO leaving unused vhosts bugs proxy
- name: clean vhosts_path
file: path={{ vhosts_path }} state=absent
when: clean_vhosts is defined
- name: virtual hosts path
file: path={{ vhosts_path }} state=directory
- name: generate dhparams
command: openssl dhparam -outform pem -out {{ conf_path }}/dhparam2048.pem 2048
args:
creates: "{{ conf_path }}/dhparam2048.pem"
- name: copy nginx common files
template: dest={{ conf_path }}/{{ common }} src={{ common }} backup=yes
with_items:
- common.conf
- common_ssl.conf
- nginx.conf
loop_control:
loop_var: common
- name: domains' stuff
block:
- name: slice matrix with those having domains defined
set_fact:
matrix_loop: "{{ matrix_loop | default([]) | union([ domino ]) }}"
with_items: "{{ matrix }}"
when: "{{ domino.domains is defined and domino.nodo is defined }}"
loop_control:
loop_var: domino
- name: certificates loop
include_tasks: ../../certbot/tasks/certbot.yml
with_items: "{{ matrix_loop | default([]) }}"
tags: certbot
loop_control:
loop_var: loop
when: (service is undefined) or (service is defined and service == loop.service_name)
- name: vhosts loop
include_tasks: vhosts.yml
with_items: "{{ matrix_loop }}"
loop_control:
loop_var: vhost
when: (service is undefined) or (service is defined and service == vhost.service_name)