Compare commits
128 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5aea3651c2 | |||
| bc44c5074e | |||
| b36346e6d3 | |||
| 957a923a7c | |||
| ed1edd6269 | |||
| 1910b37547 | |||
| 9c38fea199 | |||
| 9455e50af9 | |||
| 645630e9c8 | |||
| d4215f7e3e | |||
| 4a886418e8 | |||
| 741a026408 | |||
| d8f0b5fb66 | |||
| 31fb3b7526 | |||
| 1bf91dfa24 | |||
| e06d6a4414 | |||
| d4384187d9 | |||
| 28ad0386be | |||
| e703628d8d | |||
| 04bcec3352 | |||
| d8600ee1cb | |||
| a63bd72256 | |||
| 8b3a0babf6 | |||
| 38c8db9f53 | |||
| 860487aa9d | |||
| 0b22138ab0 | |||
| 08cb31c8c9 | |||
| 433fda716a | |||
| 61deebaf25 | |||
| 94bacbf352 | |||
| 70dc16c042 | |||
| 0b4c0534f6 | |||
| 75b2b5d269 | |||
| c0b5978ef5 | |||
| f1c5ee7654 | |||
| 4a98e1e92f | |||
| 1548d9f7c2 | |||
| c3247017f0 | |||
| a700bc0b88 | |||
| a4b66d5c49 | |||
| 539c1e47f3 | |||
| 789c0dbfcc | |||
| b36f2e3910 | |||
| c08b998d21 | |||
| fdff1e3496 | |||
| d6edca2ac6 | |||
| bd3117579a | |||
| 008a8b97ae | |||
| 9820cf1db8 | |||
| a67caf2f57 | |||
| c49a2b73cc | |||
| fc46e78fb3 | |||
| aa36848906 | |||
| 35bbc39a3d | |||
| 5f031b7688 | |||
| ee3deadaf8 | |||
| 219ede45ec | |||
| 780a848f25 | |||
| 07f3164720 | |||
| c075375ae8 | |||
| c4b114ebaa | |||
| 053ca48945 | |||
| 85f64fd7f0 | |||
| ed6691c575 | |||
| 868393a045 | |||
| 7e4eb3f21f | |||
| 1a15ebe1e8 | |||
| 4753b8a270 | |||
| 0a378d665c | |||
| ae95c2dd0e | |||
| 4bb2c14c83 | |||
| 52e7da204d | |||
| 87b77339c5 | |||
| 79f052d2a7 | |||
| 1630c554ff | |||
| f5252a4c18 | |||
| 5e61a46c4b | |||
| 9c1bae22d8 | |||
| b53f1686bf | |||
| 34672f27e6 | |||
| 6504043f4e | |||
| 142727cdcd | |||
| d7306ec168 | |||
| 078a55de7c | |||
| a91e793b28 | |||
| 71984956d3 | |||
| 81b863a359 | |||
| 9b334741c9 | |||
| b78859b71b | |||
| a2e5550967 | |||
| ae29a088af | |||
| 1229ed7276 | |||
| 7b783f861e | |||
| 8d9079ca50 | |||
| 20e13644f9 | |||
| 9aeed678e3 | |||
| 92bc0fe191 | |||
| d664a15af9 | |||
| cf63a24756 | |||
| 62b191d039 | |||
| 836a58f37e | |||
| 972321637b | |||
| f450087ab0 | |||
| d6f4a3fcd7 | |||
| 3544b27e4a | |||
| ca75a34eeb | |||
| f61f22377c | |||
| 487945bf80 | |||
| 87c922250b | |||
| 20ce4fb6f3 | |||
| b1574f1967 | |||
| eec4aafd72 | |||
| 4d4e855fcc | |||
| 1d85e24f63 | |||
| f0e4dbb7e0 | |||
| 3a2a235199 | |||
| 5546a6a8b9 | |||
| f9746c1ff2 | |||
| 6f8146aa16 | |||
| a31c155609 | |||
| da3c25fe58 | |||
| 83bcadaab0 | |||
| 60bdce36aa | |||
| 1f103c16f0 | |||
| 98ab948b9d | |||
| c42b1b773a | |||
| 37f1866300 | |||
| 3adee1fd7c |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "roles/rap/code/rap"]
|
||||
path = roles/rap/code/rap
|
||||
url = https://0xacab.org/pip/rap.git
|
||||
216
README.md
216
README.md
@ -1,17 +1,217 @@
|
||||
## DEPLOY
|
||||
# ABYAYA.LA #
|
||||
|
||||
Este sistema automatiza el despliegue de la red Abyaya.la, mediante [Ansible](https://docs.ansible.com/), un software de automatización de código abierto, que permite la gestión de configuraciones, el despliegue de aplicaciones y la orquestación de tareas.
|
||||
|
||||
- Sintaxis basada en YAML, que significa "Yet Another Markup Language". Un formato de serialización de datos legible por humanes.
|
||||
- Se definien playbooks, que son scripts que automatizan secuencias de tareas y configuraciones.
|
||||
- Opera sin necesidad de instalar agentes en los nodos gestionados, ya que se comunica a través de SSH.
|
||||
|
||||
|
||||
### abyayala.yml
|
||||
Así, gestionamos la __infraestructura como código__, en un único archivo de matriz __abyayala.yml__
|
||||
|
||||
Este describe los componentes a desplegar para qu esta red funcione. Podríamos dividirlos en dos grandes componentes:
|
||||
|
||||
### La RAP
|
||||
|
||||
La _Red Autónoma Pirata_ es la __VPN__ que nos permite acceder a nuestros servidores, sin importar el lugar donde estén conectados.
|
||||
|
||||
|
||||
|Características||
|
||||
|-------------------------------|--------------------------------------------|
|
||||
| Red | `10.13.12.1/24` |
|
||||
| DHCP | Automático |
|
||||
| Resolución de nombres | Hostname (ej. `ping ka.comun`) |
|
||||
|
||||
### El PROXY
|
||||
Es un servidor con una IP pública, a la que apuntamos el dominio __abyaya.la__.
|
||||
|
||||
Hace de **proxy reverso** para los demás servidores, ruteando el tráfico a cada servidor a través de la RAP.
|
||||
|
||||
|Características||
|
||||
|-------------------------------|--------------------------------------------|
|
||||
| Subdominios para los servidores|`nuevo.abyaya.la` |
|
||||
| Servicios en los sub-sub-dominios| Ej: `https://sitio.nuevo.abyaya.la` |
|
||||
| Certificados Wildcard| `*.nuevo.abyaya.la` |
|
||||
|
||||
----
|
||||
|
||||
# Cómo funciona
|
||||
|
||||
La idea es reducir todo a un solo comando único *deploy.yml", el cual leerá la matriz **abyayala.yml** para desplegar o actualizar, tanto a la VPN como al Proxy.
|
||||
|
||||
# Componentes Principales
|
||||
|
||||
## Estructura de Archivos
|
||||
- deploy.yml: Playbook principal, el "comando único"
|
||||
- abyayala.yml: Configuración principal (YAML) en donde se define declarativamente la infraestructura de ambos componentes (VPN y Proxy)
|
||||
- tasks/: Playbooks adicionales para tareas específicas
|
||||
- roles/: Cada rol configura un servicio del sistema
|
||||
|
||||
# ALTA DE NODOS "EN 2 PASOS"
|
||||
|
||||
Esta se hace en dos partes, pues hay que configurarlo primero en el nodo de destino y después en el servidor del proxy.
|
||||
|
||||
## 1.1 - Autorizar nuevo nodo en la RAP...
|
||||
|
||||
También tenemos que avisar a la RAP, la cual se define en el archivo abyayala.yml, en el **server_name: vpn**
|
||||
|
||||
En la lista de **nodos** mantenemos los nodos autorizados para conectarse a la RAP
|
||||
```
|
||||
- service_name: vpn
|
||||
roles:
|
||||
- rap
|
||||
nodos:
|
||||
- marmite
|
||||
- ka
|
||||
```
|
||||
Lo agregamos a la lista y ejecutamos el comando **deploy.yml** para autorizarlos.
|
||||
|
||||
Le especificaremos parámetros con **- e**:
|
||||
```
|
||||
ansible-playbook deploy.yml -e "alt=abyayala host=hetzner"
|
||||
```
|
||||
Así estamos desplegando entonces los servicios definidos en el archivo **abyayala.yml**, a nuestro servidor en **hetzner**.
|
||||
|
||||
### Parámetros de deploy.yml
|
||||
|
||||
Los parámetros obligatorios son:
|
||||
- **alt**: nombre de nuestro servidor autónomo, en este caso siempre es 'abyayala'
|
||||
- **host**: nombre del servidor de destino en el archivo de inventario hosts.production
|
||||
|
||||
Los parámetros opcionales pueden ser:
|
||||
- **service**: limita al despliegue a un servicio específico, en lugar de actualizarlos todos
|
||||
|
||||
Siguiendo con el ejemplo anterior, utilizaremos el parametro **service** para ejecutar solamente la vpn.
|
||||
|
||||
```
|
||||
ansible-playbook deploy.yml -e "host=abyayala alt=abyayala"
|
||||
ansible-playbook deploy.yml -e "alt=abyayala host=hetzner service=vpn"
|
||||
```
|
||||
|
||||
# opcional: service define despliegue de servicio especifico
|
||||
# service undefined: ejecuta todos los roles
|
||||
## 1.2 - Instalar la RAP en el nodo
|
||||
|
||||
# -e "service=defined" si es master, ejecuta su rol | si es worker, tambien pero en el otro host
|
||||
# --skip-tags=installation saltea una parte, marcada por un tag. por ejemplo, la instalacion. o --skip-tags=installation,keys
|
||||
Para desplegar la RAP en nuestro nodo destino, utilizamos otro playbook, el script **tasks/rap.yml** especificando sus parámetros con **-e
|
||||
"..."**
|
||||
|
||||
```
|
||||
ansible-playbook --become tasks/rap.yml -e "nodo=nuevo host=miservidora"
|
||||
```
|
||||
|
||||
En donde:
|
||||
- **host**: es el nodo nuevo a configurar, según su definición en el inventario de ansible
|
||||
- **nodo**: es el nombre que le daremos, el cual debe coincidir con el que desplegamos en el proxy más adelante
|
||||
|
||||
|
||||
## 2 - HABILITAR ACCESO HTTPS AL NUEVO NODO
|
||||
|
||||
Por otro lado, hay que actualizar al **Proxy** para que el nuevo nodo sea accesible por HTTPS, en un subdominio público.
|
||||
|
||||
Vemos que cada nodo debe tener una entrada en el archivo **abyayala.yml**, en donde se asocia su **subdominio público** con su **nodo en la RAP**, de esta forma:
|
||||
```
|
||||
- service_name: nuevo
|
||||
domains:
|
||||
- nuevo.abyaya.la
|
||||
nodo: nuevo.comun
|
||||
ssl: yes
|
||||
```
|
||||
Donde
|
||||
- **service_name**: es un nombre arbitrario
|
||||
- **domains**: la unica entrada de domains es el subdominio principal
|
||||
- **nodo**: es el hostname del nodo en la RAP
|
||||
- **ssl**: habilita la conexión SSL/TLS
|
||||
|
||||
### 2.2 DEPLOY.YML
|
||||
|
||||
Luego de agregar nuestro nuevo nodo, volvemos entonces a ejecutar el comando **deploy.yml** para habilitar el acceso HTTPS a éste, y publicar ese subdominio.
|
||||
|
||||
En esta ocasión, lo acotaremos a actualizar la configuración de solamente **un nodo**, especificándolo con el parámetro **service**:
|
||||
```
|
||||
ansible-playbook deploy.yml -e "alt=abyayala host=hetzner service=nuevo"
|
||||
|
||||
```
|
||||
|
||||
### DEPLOY LOCAL
|
||||
### TAGS
|
||||
|
||||
También hay **tags** que marcan secciones del código.
|
||||
|
||||
Por ejemplo se puede acotar aún más, saltándose todas las tareas de instalación con **--skip-tags**
|
||||
|
||||
```
|
||||
ansible-playbook --become deploy.yml -e "host=localhost alt=abyayala" -i hosts.local
|
||||
ansible-playbook deploy.yml -e "alt=abyayala host=hetzner service=nuevo" --skip-tags=installation
|
||||
```
|
||||
|
||||
----
|
||||
|
||||
# INSTALACIÓN
|
||||
|
||||
## Instalar Ansible
|
||||
```
|
||||
# Si tienen Python
|
||||
pip install ansible
|
||||
|
||||
# Para sistemas basados en Debian/Ubuntu
|
||||
sudo apt-get install ansible
|
||||
|
||||
# Para sistemas RHEL/CentOS
|
||||
sudo yum install ansible
|
||||
```
|
||||
## PREPARAR SSH
|
||||
|
||||
También deben tener sus llaves públicas de **SSH** añadidas tanto al nodo como al servidor de destino.
|
||||
### Generar clave SSH (si no existe)
|
||||
```
|
||||
ssh-keygen -t ed25519
|
||||
```
|
||||
### Copiar clave pública al nodo de destino
|
||||
```
|
||||
ssh-copy-id root@nuevo.comun
|
||||
```
|
||||
|
||||
### ALTA DE USUARIXS EN EL PROXY
|
||||
|
||||
Para conectarse al proxy deben agregar sus llaves como dice a continuación:
|
||||
|
||||
* Copiar la(s) llave(s) pública(s) de cada wayki en `tasks/files/ssh/WAYKI.pub`.
|
||||
* Agregarle en `group_vars/all/ssh_users.yml` (copiando la sintaxis)
|
||||
* Correr `ansible-playbook tasks/users.yml -e "host=hetzner"`
|
||||
|
||||
---
|
||||
|
||||
# TESTING
|
||||
|
||||
Si todo anda bien, podemos probarlo así:
|
||||
|
||||
## Conexión VPN
|
||||
Como resultado del deploy de la primera parte (RAP), la máquina **nodo** debe conectarse a la red comun en IPv4 y en el rango 10.13.12.1/24 y poder pingear al server, que es 10.13.12.1
|
||||
|
||||
El proxy a su vez puede pingear a cada nodo por su nombre de host en la red comun. por ej.
|
||||
```
|
||||
root@proxy-reverso-escuela-comun:~# ping ka.comun
|
||||
PING ka.comun (10.13.12.129) 56(84) bytes of data.
|
||||
64 bytes from ka.comun (10.13.12.129): icmp_seq=1 ttl=64 time=169 ms
|
||||
```
|
||||
|
||||
## Acceso HTTPS
|
||||
|
||||
Por otra parte, como resultado del despliegue de la segunda parte (PROXY), el **nodo** debe ser accesible en el subdominio **nuevo. abyaya.la**
|
||||
|
||||
Los servicios de cada nodo son accesibles a través de SSL en **sub-sub-** dominios.
|
||||
|
||||
Por ej. **https://sitio.nuevo.abyaya.la** o **https://nube.nuevo.abyaya.la**
|
||||
|
||||
|
||||
---
|
||||
## DEPLOY LOCAL
|
||||
|
||||
En este ejemplo, instalaremos todo en nuestro localhost para desarrollo, como si fuera un nodo del proxy.
|
||||
```
|
||||
ansible-playbook --become tasks/rap.yml -e "host=localhost nodo=nombrelo" -i hosts.local
|
||||
```
|
||||
Esto también es útil para instalar Ansible en nuestra terminal, junto con sus dependencias (Módulos para docker, etc.)
|
||||
|
||||
#### SSH PARA DESARROLLO
|
||||
Para autoconectarse por SSH hay que autorizarse a sí mismx:
|
||||
```
|
||||
# Habilitar auto-conexión SSH
|
||||
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
|
||||
```
|
||||
|
||||
225
abyayala.yml
225
abyayala.yml
@ -1,7 +1,228 @@
|
||||
althost: abyayala
|
||||
matrix:
|
||||
- service_name: marmita
|
||||
- service_name: comun
|
||||
roles:
|
||||
- kemal
|
||||
domains:
|
||||
- comun.abyaya.la
|
||||
|
||||
- service_name: knot
|
||||
roles:
|
||||
- knsupdate
|
||||
|
||||
- service_name: vpn
|
||||
roles:
|
||||
- rap
|
||||
nodos:
|
||||
- marmite
|
||||
- ka
|
||||
- nodochasqui
|
||||
- yanapak
|
||||
- comun01
|
||||
- pilmaiken
|
||||
- fundeps
|
||||
- lluvia
|
||||
- lazarzamora
|
||||
- padiuxi
|
||||
- otra
|
||||
- qhanapukara
|
||||
- gtanw
|
||||
- pakkiru
|
||||
- tepeyac
|
||||
- cpogt
|
||||
- vmcpogt
|
||||
- rednasa
|
||||
- respaldos
|
||||
- rednasaazun
|
||||
- comixcal
|
||||
- nodochasqui
|
||||
- narkitila
|
||||
- naxuxi
|
||||
- padiuxiterminal
|
||||
- kurmi
|
||||
- yanapaknodo2
|
||||
- tule
|
||||
- fundepsterminal
|
||||
- jilgerilla
|
||||
- sutty
|
||||
- evoterminal
|
||||
- mexe
|
||||
- chukao
|
||||
- cads
|
||||
- cadt
|
||||
- puerto
|
||||
- barrio
|
||||
- antisistema
|
||||
- rebeldia
|
||||
- kipu
|
||||
- resistencia
|
||||
- carabobolibre
|
||||
|
||||
- service_name: respaldos
|
||||
domains:
|
||||
- respaldos.abyaya.la
|
||||
nodo: respaldos.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: marmite
|
||||
domains:
|
||||
- marmite.abyaya.la
|
||||
nodo: marmite.comun
|
||||
ssl: yes
|
||||
force_https: yes
|
||||
|
||||
- service_name: ka
|
||||
domains:
|
||||
- 2012k.abyaya.la
|
||||
nodo: ka.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: yanapak
|
||||
domains:
|
||||
- yanapak.abyaya.la
|
||||
nodo: yanapak.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: comun01
|
||||
domains:
|
||||
- comun01.abyaya.la
|
||||
nodo: comun01.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: pilmaiken
|
||||
domains:
|
||||
- pilmaiken.abyaya.la
|
||||
nodo: pilmaiken.comun
|
||||
force_https: yes
|
||||
dns_extras:
|
||||
- 'del pilmaiken mx'
|
||||
- 'del pilmaiken txt'
|
||||
- 'del pilmaiken spf'
|
||||
- 'add pilmaiken mx 10 correspondencia.latina.red.'
|
||||
- 'add pilmaiken txt "v=spf1 mx a:correspondencia.latina.red -all"'
|
||||
- 'add pilmaiken spf "v=spf1 mx a:correspondencia.latina.red -all"'
|
||||
- 'add dkim._domainkey.pilmaiken txt "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDQ6JwPaawDzMXuscSgDpvipRFLGXSqgmvvI6jk18lcg0kK2lfxsvXGJ/6U7oCtKa35IEVzdigxD0o7DzklKxAsNIVbcExPJkFWzQuKuP6ATBESo7YUn7Z5qjfxBiNPS0FJp8XpbpUzN+zg/NTgmkggnwwC0tKgcEQ6HnI9AOa1LQIDAQAB"'
|
||||
- 'add _dmarc.pilmaiken txt "v=DMARC1; p=reject; rua=mailto:postmaster@correspondencia.latina.red; ruf=mailto:postmaster@correspondencia.latina.red; adkim=s; aspf=s"'
|
||||
|
||||
|
||||
- service_name: fundeps
|
||||
domains:
|
||||
- fundeps.abyaya.la
|
||||
nodo: fundeps.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: lluvia
|
||||
domains:
|
||||
- lluvia.abyaya.la
|
||||
nodo: lluvia.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: lazarzamora
|
||||
domains:
|
||||
- lazarzamora.abyaya.la
|
||||
nodo: lazarzamora.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: padiuxi
|
||||
domains:
|
||||
- padiuxi.abyaya.la
|
||||
nodo: padiuxi.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: otra
|
||||
domains:
|
||||
- otra.abyaya.la
|
||||
nodo: otra.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: qhanapukara
|
||||
domains:
|
||||
- qhanapukara.abyaya.la
|
||||
nodo: qhanapukara.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: gtanw
|
||||
domains:
|
||||
- gtanw.abyaya.la
|
||||
nodo: gtanw.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: pakkiru
|
||||
domains:
|
||||
- pakkiru.abyaya.la
|
||||
nodo: pakkiru.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: tepeyac
|
||||
domains:
|
||||
- tepeyac.abyaya.la
|
||||
nodo: tepeyac.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: cpogt
|
||||
domains:
|
||||
- cpogt.abyaya.la
|
||||
nodo: cpogt.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: rednasa
|
||||
domains:
|
||||
- rednasa.abyaya.la
|
||||
nodo: rednasa.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: sutty
|
||||
domains:
|
||||
- sutty.abyaya.la
|
||||
nodo: sutty.comun
|
||||
force_https: yes
|
||||
enable_compression: yes
|
||||
|
||||
- service_name: mexe
|
||||
domains:
|
||||
- mexe.abyaya.la
|
||||
nodo: mexe.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: chukao
|
||||
domains:
|
||||
- chukao.abyaya.la
|
||||
nodo: chukao.comun
|
||||
force_https: yes
|
||||
enable_compression: yes
|
||||
|
||||
- service_name: cads
|
||||
domains:
|
||||
- cads.abyaya.la
|
||||
nodo: cads.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: puerto
|
||||
domains:
|
||||
- puerto.abyaya.la
|
||||
nodo: puerto.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: barrio
|
||||
domains:
|
||||
- barrio.abyaya.la
|
||||
nodo: barrio.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: rebeldia
|
||||
domains:
|
||||
- rebeldia.abyaya.la
|
||||
nodo: rebeldia.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: kipu
|
||||
domains:
|
||||
- kipu.abyaya.la
|
||||
nodo: kipu.comun
|
||||
force_https: yes
|
||||
|
||||
- service_name: carabobolibre
|
||||
domains:
|
||||
- carabobolibre.abyaya.la
|
||||
nodo: carabobolibre.comun
|
||||
force_https: yes
|
||||
|
||||
|
||||
10
ansible.cfg
10
ansible.cfg
@ -1,2 +1,12 @@
|
||||
[defaults]
|
||||
inventory = ./hosts.production
|
||||
forks = 10
|
||||
|
||||
[ssh_connection]
|
||||
ssh_args = -C -o ControlMaster=auto -o ControlPersist=1h -o PreferredAuthentications=publickey -o ForwardAgent=yes
|
||||
control_path_dir = ~/.ansible/cp
|
||||
control_path = /tmp/ssh-%%r@%%h:%%p
|
||||
pipelining = True
|
||||
scp_if_ssh = smart
|
||||
transfer_method = smart
|
||||
sftp_batch_mode = True
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
# ansible-playbook --vault-id @prompt deploy.yml -e "host=digitalocean alt=numerica"
|
||||
# ansible-playbook --vault-id @prompt deploy.yml -e "alt=abyayala host=hetzner"
|
||||
# opcional: service define despliegue de servicio especifico
|
||||
---
|
||||
- hosts: "{{ host }}"
|
||||
tasks:
|
||||
- name: "unnattended upgrades"
|
||||
apt:
|
||||
name: "unnattended-upgrades"
|
||||
state: "present"
|
||||
- name: import matrix
|
||||
local_action: "include_vars dir=./ files_matching={{ alt }}.yml"
|
||||
|
||||
- include_role: name=althost
|
||||
|
||||
- include_role: name=users
|
||||
tags: users, installation
|
||||
|
||||
- include_role: name=proxy
|
||||
tags: proxy
|
||||
|
||||
|
||||
@ -1,14 +1,31 @@
|
||||
---
|
||||
ssh_users:
|
||||
- name: beto
|
||||
- name: numerica
|
||||
comment: "Roberto Soto"
|
||||
sudo: yes
|
||||
servers_allow:
|
||||
- all
|
||||
|
||||
# - name: latina
|
||||
# comment: "intra servers"
|
||||
# root: yes
|
||||
# servers_allow:
|
||||
# - macarena.latina.red
|
||||
- name: infinito
|
||||
comment: "infinito@fedora"
|
||||
sudo: yes
|
||||
servers_allow:
|
||||
- all
|
||||
|
||||
- name: pirra
|
||||
comment: "pirra@drwagnerjr"
|
||||
sudo: yes
|
||||
servers_allow:
|
||||
- all
|
||||
|
||||
- name: chasqui
|
||||
comment: ""
|
||||
sudo: yes
|
||||
servers_allow:
|
||||
- all
|
||||
|
||||
- name: fauno
|
||||
comment: ""
|
||||
sudo: yes
|
||||
servers_allow:
|
||||
- all
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
host_ip: 5.161.236.18
|
||||
proxy_scale: 2
|
||||
domains_default_force_https: yes
|
||||
@ -1,8 +1,13 @@
|
||||
[localhost]
|
||||
127.0.0.1
|
||||
|
||||
[abyayala]
|
||||
[hetzner]
|
||||
5.161.236.18
|
||||
|
||||
[abyayala:vars]
|
||||
[hetzner:vars]
|
||||
ansible_ssh_user=root
|
||||
|
||||
[sutty]
|
||||
sutty.nl
|
||||
|
||||
[sutty:vars]
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
- name: docker apt repository
|
||||
apt_repository:
|
||||
repo: deb [arch=amd64] https://download.docker.com/linux/debian bullseye stable
|
||||
repo: deb [arch=amd64] https://download.docker.com/linux/debian bookworm stable
|
||||
|
||||
- name: install docker community edition
|
||||
apt:
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
state: started
|
||||
volumes:
|
||||
- "{{ althost }}_certs_data:/etc/letsencrypt"
|
||||
command: "--non-interactive --agree-tos --email {{ webmaster_email }} certonly --preferred-challenges dns --authenticator dns-standalone --dns-standalone-address={{ host_ip }} --dns-standalone-port=53 --dns-standalone-propagation-seconds=60 -d {{ loop.domains[0] }} -d *.{{ loop.domains[0] }}"
|
||||
command: "--non-interactive --agree-tos --email {{ webmaster_email }} certonly --preferred-challenges dns --authenticator dns-standalone --dns-standalone-address={{ host_ip }} --dns-standalone-port=53 --dns-standalone-propagation-seconds=10 {% for domain in loop.domains %} -d {{ domain }} -d *.{{ domain }} {% endfor %}"
|
||||
detach: no
|
||||
cleanup: yes
|
||||
ports:
|
||||
|
||||
@ -2,10 +2,14 @@
|
||||
apt:
|
||||
name: dnsmasq
|
||||
state: present
|
||||
|
||||
- name: configuracion de red comun
|
||||
template:
|
||||
src: dnsmasq.conf
|
||||
dest: "/etc/dnsmasq.conf"
|
||||
notify:
|
||||
- restart dnsmasq
|
||||
- name: activar el servicio
|
||||
systemd_service:
|
||||
name: dnsmasq
|
||||
enabled: true
|
||||
state: restarted
|
||||
|
||||
10
roles/kemal/templates/vhost.conf
Normal file
10
roles/kemal/templates/vhost.conf
Normal file
@ -0,0 +1,10 @@
|
||||
server {
|
||||
server_name {{ vhost.domains | join(' ') }};
|
||||
listen 80;
|
||||
|
||||
client_max_body_size 4k;
|
||||
|
||||
location / {
|
||||
proxy_pass http://10.13.12.1:3000;
|
||||
}
|
||||
}
|
||||
22
roles/knsupdate/tasks/loop.yml
Normal file
22
roles/knsupdate/tasks/loop.yml
Normal file
@ -0,0 +1,22 @@
|
||||
- include_vars: dir="../vars" files_matching="main.yml"
|
||||
|
||||
- name: import matrix
|
||||
local_action: "include_vars dir=../../../ files_matching={{ alt }}.yml"
|
||||
|
||||
- name: domains' stuff
|
||||
block:
|
||||
- name: filtrar solo los servicios de la matrix que definen dominios DNS
|
||||
set_fact:
|
||||
matrix_loop: "{{ matrix_loop | default([]) | union([ domino ]) }}"
|
||||
with_items: "{{ matrix }}"
|
||||
when: "{{ domino.domains is defined }}"
|
||||
loop_control:
|
||||
loop_var: domino
|
||||
|
||||
- name: knsupdate ACTUALIZA A KNOT ACERCA DE CADA DOMINIO
|
||||
include_tasks: ./update.yml
|
||||
with_items: "{{ matrix_loop }}"
|
||||
loop_control:
|
||||
loop_var: vhost
|
||||
tags: knot
|
||||
|
||||
6
roles/knsupdate/tasks/main.yml
Normal file
6
roles/knsupdate/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
- name: "required packages"
|
||||
apt:
|
||||
name: "knot-dnsutils"
|
||||
state: "present"
|
||||
|
||||
- include_tasks: loop.yml
|
||||
19
roles/knsupdate/tasks/templates/commands.j2
Normal file
19
roles/knsupdate/tasks/templates/commands.j2
Normal file
@ -0,0 +1,19 @@
|
||||
{% for dns_server in dns_servers %}
|
||||
server {{ dns_server }}
|
||||
zone abyaya.la.
|
||||
origin abyaya.la.
|
||||
ttl 60
|
||||
del {{ vho }} a
|
||||
del {{ vho }} ns
|
||||
add {{ vho }} a {{ host_ip }}
|
||||
add *.{{ vho }} a {{ host_ip }}
|
||||
add _acme-challenge.{{ vho }} a {{ host_ip }}
|
||||
add _acme-challenge.{{ vho }} ns _acme-challenge
|
||||
{% if vhost.dns_extras is defined %}
|
||||
{% for dns_extra in vhost.dns_extras %}
|
||||
{{ dns_extra }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
send
|
||||
{% endfor %}
|
||||
quit
|
||||
7
roles/knsupdate/tasks/update.yml
Normal file
7
roles/knsupdate/tasks/update.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- set_fact:
|
||||
vho: "{{ vhost.domains[0] | regex_replace('([a-z0-9]+)\\.abyaya\\.la', '\\1')}}"
|
||||
|
||||
- name: knsupdate
|
||||
shell: knsupdate
|
||||
args:
|
||||
stdin: "{{ lookup('template', 'templates/commands.j2') }}"
|
||||
5
roles/knsupdate/vars/main.yml
Normal file
5
roles/knsupdate/vars/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
dns_servers:
|
||||
- "anarres.sutty.nl"
|
||||
- "athshe.sutty.nl"
|
||||
- "gethen.sutty.nl"
|
||||
- "ganam.sutty.nl"
|
||||
@ -0,0 +1 @@
|
||||
return 301 https://hedgedoc.sutty.abyaya.la$request_uri;
|
||||
6
roles/proxy/files/custom_proxy_includes/sutty.abyaya.la
Normal file
6
roles/proxy/files/custom_proxy_includes/sutty.abyaya.la
Normal file
@ -0,0 +1,6 @@
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
proxy_redirect off;
|
||||
proxy_connect_timeout 3m;
|
||||
proxy_send_timeout 3m;
|
||||
proxy_read_timeout 3m;
|
||||
1
roles/proxy/files/custom_server_includes/2012k.abyaya.la
Normal file
1
roles/proxy/files/custom_server_includes/2012k.abyaya.la
Normal file
@ -0,0 +1 @@
|
||||
client_max_body_size 0;
|
||||
@ -2,6 +2,10 @@
|
||||
include_role: name=dnsmasq
|
||||
tags: dns
|
||||
|
||||
- name: knsupdate
|
||||
include_role: name=knsupdate
|
||||
tags: knot
|
||||
|
||||
- name: certbot role
|
||||
include_role: name=certbot
|
||||
tags: certbot
|
||||
@ -40,7 +44,7 @@
|
||||
set_fact:
|
||||
matrix_loop: "{{ matrix_loop | default([]) | union([ domino ]) }}"
|
||||
with_items: "{{ matrix }}"
|
||||
when: "{{ domino.domains is defined }}"
|
||||
when: "{{ domino.domains is defined and domino.nodo is defined }}"
|
||||
loop_control:
|
||||
loop_var: domino
|
||||
|
||||
|
||||
@ -1,10 +1,29 @@
|
||||
|
||||
- set_fact:
|
||||
vhost_dest: "{{ vhosts_path }}/{{ vhost.domains[0] }}.conf"
|
||||
|
||||
- name: generate nginx vhosts
|
||||
- block:
|
||||
- set_fact:
|
||||
custom_vhost: "roles/{{ vhost.roles[0] }}/templates/vhost.conf"
|
||||
- set_fact:
|
||||
proxy_conf: "roles/{{ vhost.roles[0] }}/templates/proxy.conf"
|
||||
when: vhost.roles is defined
|
||||
|
||||
- set_fact:
|
||||
proxy_conf_look: "{{ lookup('template', proxy_conf) }}"
|
||||
when: proxy_conf is defined and proxy_conf is is_file
|
||||
|
||||
- name: generate default vhosts
|
||||
template:
|
||||
src: "{{ default_vhost }}"
|
||||
dest: "{{ vhost_dest }}"
|
||||
when: (vhost.roles is undefined or vhost.roles[0] == 'proxy') or (custom_vhost is undefined or custom_vhost is not is_file)
|
||||
notify:
|
||||
- reload proxy
|
||||
|
||||
- name: generate nginx custom vhosts
|
||||
template:
|
||||
src: "{{ custom_vhost }}"
|
||||
dest: "{{ vhost_dest }}"
|
||||
when: (vhost.roles is defined and vhost.roles[0] != 'proxy') and custom_vhost is defined and custom_vhost is is_file
|
||||
notify:
|
||||
- reload proxy
|
||||
|
||||
@ -1,15 +1,31 @@
|
||||
# BEGIN PROXY
|
||||
location / {
|
||||
proxy_ssl_verify off;
|
||||
proxy_ssl_name $comun;
|
||||
proxy_ssl_server_name on;
|
||||
{% if vhost.enable_compression | default(false) %}
|
||||
gzip on;
|
||||
gzip_static on;
|
||||
gzip_proxied any;
|
||||
gzip_http_version 1.1;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 10240;
|
||||
gzip_vary on;
|
||||
gzip_types application/atom+xml application/javascript text/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/plain text/x-component;
|
||||
|
||||
proxy_pass https://$comun_{{ vhost.nodo | replace(".", "_") }};
|
||||
gzip_disable "msie6";
|
||||
{% endif %}
|
||||
client_max_body_size 1G;
|
||||
proxy_ssl_verify off;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name $ssl_server_name;
|
||||
|
||||
proxy_pass https://$comun_{{ vhost.nodo | replace(".", "") }};
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection upgrade;
|
||||
|
||||
{% include "files/custom_proxy_includes/" ~ vhost.domains[0] ignore missing %}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
map $http_host $comun_{{ vhost.nodo | replace(".", "_") }} {
|
||||
map $http_host $comun_{{ vhost.nodo | replace(".", "") }} {
|
||||
hostnames;
|
||||
{% for domain in vhost.domains %}
|
||||
.{{ domain }} {{ vhost.nodo }};
|
||||
@ -10,7 +10,7 @@ server {
|
||||
|
||||
listen 80;
|
||||
|
||||
resolver 127.0.0.1 valid=300s;
|
||||
resolver 10.13.12.1 valid=300s;
|
||||
resolver_timeout 5s;
|
||||
|
||||
{% if not needs_vhost and ((vhost.ssl | default(domains_default_ssl) ) or (vhost.force_https | default(domains_default_force_https))) %}
|
||||
@ -38,7 +38,11 @@ server {
|
||||
|
||||
include conf/common.conf;
|
||||
|
||||
{% include "default_proxy.conf" %}
|
||||
{% if proxy_conf is defined and proxy_conf is is_file %}
|
||||
{{ proxy_conf_look }}
|
||||
{% else %}
|
||||
{% include "default_proxy.conf" %}
|
||||
{% endif %}
|
||||
|
||||
{% include "files/custom_server_includes/" ~ vhost.domains[0] ignore missing %}
|
||||
|
||||
|
||||
1
roles/rap/code/rap
Submodule
1
roles/rap/code/rap
Submodule
Submodule roles/rap/code/rap added at ec4cd71e6e
@ -1,16 +0,0 @@
|
||||
Address = latina.red
|
||||
Port = 65000
|
||||
|
||||
-----BEGIN RSA PUBLIC KEY-----
|
||||
MIICCgKCAgEAv0oPDlf8mbr8fbiLLfUEucm5QxFLxarqhuph/ui3PmDXoiJGQK0d
|
||||
zHl92dYDdgRMw+4b1ogThGUZ8ryAt3UtpD8B6oLCRmhGn2tjNIFQN3kUIJQ3aa+M
|
||||
5nEBf6ys0IHEieUYVHXr5lxSc09Y/wsNbtATVZ25VT0ercR0c3gbpcypu8JpTdyn
|
||||
iul43IXiO8zKjeQhn9VQAnwIMzAa+6Y5Aj4y2HtFsUqzjJYY3KZBRTTNR1277QJ8
|
||||
NDMuQT0opE79E8ipOZaOdcFRZIUOG8cBhhavozSVCzjI8A1iA8QrJpEjo/zjV+D4
|
||||
h5EQpztvvzYdlOsE/9Cclc+iAGbnxOUt6K2bopMu/TI+gNh7DoA2wgFZ7DlQhCuO
|
||||
MiYV+9dzI4gKZvAO0IxiGnmq8s2UjWRnD9zVZztU5IOE1xBo7OrmcHnnOvsMMsmx
|
||||
Bc8F8jR6u8XgfSODS22sNK62N9joC2E3Gg/ulW75IUqIlyyHumwjm0XMuIXI6qDZ
|
||||
AUv0lOnYOWATveQlgCqLO9OyJmocbejz1ZtkcLgI/EDzwDYEpaKLf+39a7eLuNRa
|
||||
sqf+BIoJkGxi6LVG8gW5YhOLaaPclmsOztiID7vPHs0jH4bY7N0JR2TI8aaIlY9O
|
||||
P6ZJArG60IPtMUvurTrSmUGdHLoSg6+PSPZLfYMXoqKatrAhdEcc9ssCAwEAAQ==
|
||||
-----END RSA PUBLIC KEY-----
|
||||
@ -1,16 +0,0 @@
|
||||
Address = tierra
|
||||
Port = 65000
|
||||
|
||||
-----BEGIN RSA PUBLIC KEY-----
|
||||
MIICCgKCAgEAtr75G3mVKBr8k7Sz5LQLuOBMdN2cwIZVQt0BVPq/gWeUowDPM8he
|
||||
QcjmSDZrwRE0NUQRiB5/Gicb9UXoQaEfq7xQfgcMl4Nt9MfHbhY6sORviAyHOsjM
|
||||
xYw/vy5SfWq3O7E/sH01BEbUt5r/oVoG2dy2rDQ5xBW30zeMJisvTMH5kMwHAWIG
|
||||
kdq0xI1WgFEa8eXo004Li8QD9k064wajN3mU0rUXEY0FCl9GbjP1S6a6ge3Sz+MP
|
||||
Je5RZzbNxvtY/YVeQBzjwUDawsjTZ9Lx968U9RaO2Z7LBrltLSSVU4aw6tH78zN8
|
||||
qVZ5PR0LmUQ38FWYNGcbUtfWRQACZOYkgBKbR0UOyLIbEODMUMmqZD7yOwAWf9BI
|
||||
Tw8NemFmkCs+Jb2LrayIOYaqvV3iY01oL2NgPhjV01XLs51GnHmiWUTfsEvu1lmM
|
||||
2uJoX75AzlL8We2RgWjknux3m4ce1sVTzMM36uatoz2lLDwBw9F6RKd2h6Gwb0kI
|
||||
k5ltlnjEttyQg/X1NowQClOfaUza+75mGaj1owK1zoYWZEUk4iRwoCT0KM1jnSKz
|
||||
z4w0uDz9YHhHDEG/evD6VLgPLcXdU2a+dKMU5GLGOcElKxi0p9bfzLJ9Efb2+PEY
|
||||
IJYfFlMT3YEacWsxLFuxUGbTbVCNccCIwv6QVQ8gnio+rowr8q64wwkCAwEAAQ==
|
||||
-----END RSA PUBLIC KEY-----
|
||||
38
roles/rap/tasks/client.yml
Normal file
38
roles/rap/tasks/client.yml
Normal file
@ -0,0 +1,38 @@
|
||||
# DHCLIENT ESTA DEPRCADO
|
||||
# https://serverfault.com/questions/1108989/isc-dhcp-client-dhclient-alternative
|
||||
- name: instalar dependecias de la RAP
|
||||
apt:
|
||||
name: ['tinc', 'rsync', 'dhcp5']
|
||||
state: latest
|
||||
# update_cache: yes
|
||||
tags: installation
|
||||
|
||||
- include_vars: dir="../vars" files_matching="main.yml"
|
||||
|
||||
- name: copiar el codigo fuente
|
||||
synchronize:
|
||||
src: ../roles/rap/code/rap
|
||||
dest: "{{ rap_path }}"
|
||||
perms: true
|
||||
|
||||
- name: hacer ejecutable el archivo rap
|
||||
file:
|
||||
path: "{{ rap_path }}/rap/rap"
|
||||
state: touch
|
||||
mode: '774'
|
||||
modification_time: preserve
|
||||
access_time: preserve
|
||||
|
||||
- name: inicializar el nodo
|
||||
shell:
|
||||
cmd: "./rap init -i {{ nodo }}"
|
||||
chdir: "{{ rap_path }}/rap"
|
||||
environment:
|
||||
NETWORK: comun
|
||||
|
||||
- name: instalar el nodo
|
||||
shell:
|
||||
cmd: "./rap install -v {{ nodo }}"
|
||||
chdir: "{{ rap_path }}/rap"
|
||||
environment:
|
||||
NETWORK: comun
|
||||
35
roles/rap/tasks/main.yml
Normal file
35
roles/rap/tasks/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
- name: instalar dependecias de la RAP
|
||||
apt:
|
||||
name: ['tinc', 'rsync', 'git']
|
||||
state: present
|
||||
tags: installation
|
||||
|
||||
# TODO: ERROR! conflicting action statements: synchronize, creates
|
||||
# - name: copiar el codigo fuente
|
||||
# synchronize:
|
||||
# src: ../roles/rap/code/rap/
|
||||
# dest: "{{ rap_path }}"
|
||||
# perms: true
|
||||
# rsync_opts:
|
||||
# - "--exclude=.git"
|
||||
# tags: rap
|
||||
# creates: "{{ rap_path }}"
|
||||
|
||||
- name: agregar nodos a la VPN
|
||||
shell:
|
||||
cmd: "./rap add-host {{ althost }} {{ nod }}"
|
||||
chdir: "{{ rap_path }}"
|
||||
args:
|
||||
creates: "{{ rap_path }}/networks/comun/abyayala/hosts/{{ nod }}"
|
||||
environment:
|
||||
NETWORK: comun
|
||||
with_items: "{{ item.nodos }}"
|
||||
loop_control:
|
||||
loop_var: nod
|
||||
|
||||
- name: actualizar la VPN
|
||||
shell:
|
||||
cmd: "./rap install -v {{ althost }}"
|
||||
chdir: "{{ rap_path }}"
|
||||
environment:
|
||||
NETWORK: comun
|
||||
1
roles/rap/vars/main.yml
Normal file
1
roles/rap/vars/main.yml
Normal file
@ -0,0 +1 @@
|
||||
rap_path: "/root/rap"
|
||||
1
tasks/files/ssh/chasqui.pub
Normal file
1
tasks/files/ssh/chasqui.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII3J2KEOs3PN50dRiA69qci3XV8vUtbd13RWYjRZzAVV chasqui@laboportatil
|
||||
1
tasks/files/ssh/fauno.pub
Normal file
1
tasks/files/ssh/fauno.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIOceAWSgtO+0pFhvhYGMlHTbpXIN1LDJK1Hx0qgw9qW fauno@local
|
||||
1
tasks/files/ssh/infinito.pub
Normal file
1
tasks/files/ssh/infinito.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJYJlf9XD7scKJIQX7ufxYSiZ9FALOiXPLy6g3oKyR56 infinito@fedora
|
||||
1
tasks/files/ssh/numerica.pub
Normal file
1
tasks/files/ssh/numerica.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCrhho0oQcAWX6ndpwxkNykJTohUg6vvEplqBa5pENU1gD61eahP4BU4weGrOWY28fBy3BhXOYFITWOxmdv7V7T9fG8WKXqT8MHkC9zaLzAZJ11tHq8OeDo0QGkBOoetf0dv0e3+FNijA9QKhqiwz+v0t5Ev0bSuSl28zHI3Tr0vF98SZulIR9CxDTTPA+Hel2Tl+LcVDZb80/tG9oAFBctzMK7AWB80X/DgXVfY0qgP97809JPX+Cqo/Q+LK55HxeDnfqDsA3m3KXQPODZm6ATEfmcx3MBYqJ8m0rdMKBwR16xDvAyB/LezHVCgmQvmzTRgzTwwwitOX83F5oIEArTK64s1dm0VLzj+Pw5Tetkde4YPHfajffXUbUxGTgD6M3NCvCLHedDMQDQT3LNOfFJGngGcwWJdStmMCWR6dd81epzPZiWHEZ093UWCPtE8kvrL4fRfIc/qSKWNCIyAoagKw4SwwyOfg0ONBJpjOfI7+vBKJVCZSDZQYyU/+Bo60k= berto@concon
|
||||
1
tasks/files/ssh/pirra.pub
Normal file
1
tasks/files/ssh/pirra.pub
Normal file
@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6XFkmTCotjxvlwxcmXrZcs7nmY/gtgc4FQorge9EGBWBXDLy3+tMel0XzHu9P8vKGGPEiw9TjIyBG6sEujwq74+q3rR6w2WfELEXRfIyq7HXpWtmL7RUYRrz7syfCvof8YXAPbYGv/ai7IYI41VzOHaI3mliIX+T5R74954ksI72n/qzsYHdiMHkYOGcO8P/n6T2R/SIdXCkDeCuc47IPVjSb4jTC5elv6p5YPSTozEcRP2TgkjWAa+JHXhzbknHUv6qphJVVSn66O5TYZJBXfkM0v4+7sm8k6nMP7CFkvyAN/YuvL+ZDy3XXQacG7c39meXlCdW0czyhjsvJLyaoZoH5mXPJAQkTJO8bZhJTs26gOCih9mpjr9DjbLKEv85/qyKbzUCxoBqOeaD58De1g9csy0eFo2wMx4xczKKUoWDBswOL58AfXX9CV/pPMbgjIYrkcKzfVxxfeNH+UwNLaC+J1iiHX7V1vVK1D0hQOKbEH/LdOFEzUTmluLsOwd4OXc00cPzsfqal9tiJ9/FIP9fbcCg6z+8zkZaC07+9XpclnmN9Zm0mx7JLzeFgJU1N0ij3rEA399ZjQmcnXjtFM0tW0catBvBIKi7ltxZ+FeGTDoS3w4NhMJkfzs93OSjE2kBtROwHYDM1vUpv/nzNg/DaCJ9HA2VAx0C7sMOlUQ== pirra@drwagnerjr
|
||||
8
tasks/knot.yml
Normal file
8
tasks/knot.yml
Normal file
@ -0,0 +1,8 @@
|
||||
# Instalacion de KNOT - por ahora se ejecuta contra sutty, con variable host (local) e inventario especificado
|
||||
# ansible-playbook --become tasks/knot.yml -e "host=localhost alt=abyayala" -i hosts.local
|
||||
---
|
||||
- hosts: "{{ host }}"
|
||||
tasks:
|
||||
- name: actualizacion de KNOT en el servidor DNS en la configuracion por vhost
|
||||
include_tasks: ../roles/knsupdate/tasks/loop.yml
|
||||
|
||||
@ -1,72 +1,7 @@
|
||||
# ansible-playbook rap.yml -e "host=hetzner"
|
||||
# Instalacion de la RAP en maquina local
|
||||
# ansible-playbook --become tasks/rap.yml -e "host=localhost nodo=chem" -i hosts.local
|
||||
---
|
||||
- hosts: "{{ host }}"
|
||||
vars:
|
||||
rap:
|
||||
port: 65000
|
||||
rap_dir: "{{ directory | default('/root') }}"
|
||||
environment:
|
||||
PATH: "/usr/sbin:{{ ansible_env.PATH }}"
|
||||
tasks:
|
||||
|
||||
- name: install dependencies
|
||||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- rsync
|
||||
- git
|
||||
- tinc
|
||||
become: yes
|
||||
|
||||
- name: iptables
|
||||
iptables:
|
||||
action: append
|
||||
chain: INPUT
|
||||
table: filter
|
||||
destination_port: "{{ rap.port }}"
|
||||
protocol: "{{ item }}"
|
||||
jump: ACCEPT
|
||||
loop:
|
||||
- tcp
|
||||
- udp
|
||||
become: yes
|
||||
|
||||
- name: install rap
|
||||
git:
|
||||
repo: "https://0xacab.org/pip/rap.git"
|
||||
dest: "{{ rap_dir }}/rap"
|
||||
|
||||
- set_fact:
|
||||
hostname: "{% if '{{ host }} != localhost' %} {{ ansible_hostname }} {% else %} {{ inventory_hostname }} {% endif %}"
|
||||
# inventory_hostname=> localhost/IP | ansible_hostname=>infra
|
||||
|
||||
- name: node name
|
||||
shell: 'echo {{ hostname }} | tr -cd "[:alnum:]" | tr "[:upper:]" "[:lower:]"'
|
||||
register: node_name
|
||||
changed_when: false
|
||||
|
||||
- stat:
|
||||
path: "{{ rap_dir }}/rap/hosts/{{ node_name.stdout }}"
|
||||
register: node_exists
|
||||
|
||||
- name: init node
|
||||
when: "node_exists.stat.exists == False"
|
||||
shell: "cd {{ rap_dir }}/rap && ./rap init -f -a {{ hostname }} -p {{ rap.port }}"
|
||||
|
||||
- name: fetch hosts files
|
||||
fetch:
|
||||
flat: true
|
||||
src: "{{ rap_dir }}/rap/hosts/{{ node_name.stdout }}"
|
||||
dest: "./rap/hosts/{{ node_name.stdout }}"
|
||||
|
||||
- name: copy hosts files
|
||||
copy:
|
||||
src: "./rap/hosts/"
|
||||
dest: "{{ rap_dir }}/rap/hosts/"
|
||||
|
||||
- name: connectto
|
||||
shell: 'cd {{ rap_dir }}/rap && for host in ./hosts/*; do test "./hosts/{{ node_name.stdout }}" = "${host}" && continue ; basename "${host}" | xargs -r ./rap connectto "{{ node_name.stdout }}"; done'
|
||||
|
||||
- name: install node
|
||||
shell: "cd {{ rap_dir }}/rap && ./rap install {{ node_name.stdout }}"
|
||||
- name: instalacion de la RAP en maquina cliente
|
||||
include_tasks: ../roles/rap/tasks/client.yml
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
# ansible-playbook --vault-id @prompt users.yml -e "host=hetzner"
|
||||
# Creacion de usuarixs linux y publicacion de llaves ssh
|
||||
# ansible-playbook tasks/users.yml -e "host=localhost"
|
||||
---
|
||||
- hosts: "{{ host }}"
|
||||
tasks:
|
||||
- include_role:
|
||||
name: users
|
||||
- name: llamar al rol tasks
|
||||
include_tasks: ../roles/users/tasks/main.yml
|
||||
|
||||
Reference in New Issue
Block a user