Compare commits

...

8 Commits

Author SHA1 Message Date
Bet@
091e80ac46 Merge branch 'master' into prosshy 2024-11-26 14:29:35 -03:00
Bet@
f0fa5836f1 una terminal 2024-11-06 18:07:58 -03:00
f
28332f1456 feat: respaldos 2024-11-06 18:07:58 -03:00
f
8d45878c4d fix: agregar ganam 2024-11-06 18:07:58 -03:00
Bet@
e33a409f22 proxy SSH en el 222 y git en el 2222 2024-10-30 16:43:05 -03:00
Bet@
abaffb4dd7 proxy SSH Nginx funcional 2024-10-27 13:23:12 -03:00
Bet@
167d7ba730 Merge branch 'master' into prosshy 2024-10-27 12:28:53 -03:00
Bet@
723d858110 añadiendo stream {} en nginx.conf 2024-10-27 12:18:58 -03:00
6 changed files with 92 additions and 9 deletions

View File

@ -14,13 +14,13 @@
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: configuration paths
file: path={{ comun }} state=directory
with_items:
- "{{ stream_path }}"
- "{{ conf_path }}"
loop_control:
loop_var: comun
- name: virtual hosts path
file: path={{ vhosts_path }} state=directory
@ -35,6 +35,7 @@
with_items:
- common.conf
- common_ssl.conf
- nginx.conf
loop_control:
loop_var: common
@ -62,3 +63,10 @@
loop_control:
loop_var: vhost
when: (service is undefined) or (service is defined and service == vhost.service_name)
- name: streams loop
include_tasks: stream.yml
with_items: "{{ matrix_loop }}"
loop_control:
loop_var: vhost
when: (service is undefined) or (service is defined and service == vhost.service_name)

View File

@ -0,0 +1,9 @@
- set_fact:
vhost_dest: "{{ stream_path }}/{{ vhost.domains[0] }}.conf"
- name: default stream for ssh
template:
src: "{{ default_stream }}"
dest: "{{ vhost_dest }}"
notify:
- reload proxy

View File

@ -0,0 +1,36 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
stream {
include /etc/nginx/stream.d/*.conf;
}

View File

@ -8,11 +8,13 @@
ports:
- "80:80"
- "443:443"
- "222:222"
- "2222:2222"
networks:
- proxy
volumes:
- "{{ vhosts_path }}:/etc/nginx/conf.d/"
- "{{ conf_path }}:/etc/nginx/conf/"
- "certs_data:{{ nginx_certs_path }}:ro"
- "{{ conf_path }}/nginx.conf:/etc/nginx/nginx.conf:ro"
- "{{ stream_path }}:/etc/nginx/stream.d/"

View File

@ -0,0 +1,26 @@
upstream ssh_{{ vhost.nodo | replace(".", "") }} {
server {{ vhost.nodo }}:22;
}
upstream gitea_{{ vhost.nodo | replace(".", "") }} {
server {{ vhost.nodo }}:2222;
}
server {
listen 222;
server_name {{ vhost.domains | join(' ') }};
proxy_pass ssh_{{ vhost.nodo | replace(".", "") }};
}
server {
listen 2222;
server_name git.{{ vhost.domains[0] }};
proxy_pass gitea_{{ vhost.nodo | replace(".", "") }};
}

View File

@ -3,12 +3,14 @@ domains_default_force_https: no
# nginx
vhosts_path: "{{ compose_path }}/proxy/vhosts"
stream_path: "{{ compose_path }}/proxy/stream"
conf_path: "{{ compose_path }}/proxy/conf"
nginx_certs_path: /etc/nginx/certs
# defaults
needs_vhost: no
default_vhost: roles/proxy/templates/vhost.conf
default_stream: roles/proxy/templates/stream.conf
# certbot
webmaster_email: webmaster@numerica.cl