Restaurando estructura Ansible completa

This commit is contained in:
SysAdmin DCC 2025-11-30 21:38:59 +00:00
parent 46957a6895
commit 902094bdac
9 changed files with 85 additions and 0 deletions

9
group_vars/all.yml Normal file
View File

@ -0,0 +1,9 @@
---
timezone: "Europe/Madrid"
sysadmin_email: "admin@alicante.local"
global_db_root_pass: "RootSecret123"
global_db_app_pass: "AppSecret123"
global_redis_pass: "RedisSecret123"
authentik_secret: "GenerarStringLargoAleatorio123456"
authentik_pg_pass: "AuthDBSecret123"
pg_version: "16"

5
inventory.ini Normal file
View File

@ -0,0 +1,5 @@
[gateway_group]
alicante-gateway ansible_host=10.10.10.100 ansible_user=root
[core_group]
alicante-core ansible_host=10.10.10.102 ansible_user=root

View File

@ -0,0 +1,19 @@
---
- name: Actualizar Sistema
apt: update_cache=yes upgrade=dist
- name: Instalar Dependencias Base
apt: name=['curl','git','htop','ufw','gnupg','sudo','python3-pip','python3-psycopg2'] state=present
- name: Instalar Docker
shell: curl -fsSL https://get.docker.com | sh
args:
creates: /usr/bin/docker
- name: Instalar Webmin
shell: |
curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
sh setup-repos.sh
apt-get install webmin --install-recommends -y
args:
creates: /etc/webmin

View File

@ -0,0 +1,7 @@
---
- name: Crear Red Interna
community.docker.docker_network: name=alicante_net
- name: Crear directorios
file: path=/opt/stacks/{{ item }} state=directory
loop: ['infra-shared', 'business', 'docs', 'dashboard']

View File

@ -0,0 +1,18 @@
---
- name: Crear directorios
file: path=/opt/stacks/{{ item }} state=directory mode=0755
loop: ['npm', 'authentik']
- name: Configurar NPM
template: src=npm-compose.j2 dest=/opt/stacks/npm/compose.yaml
- name: Configurar Authentik
template: src=authentik-compose.j2 dest=/opt/stacks/authentik/compose.yaml
vars:
authentik_host_ip: "{{ ansible_host }}"
- name: Levantar Stacks
community.docker.docker_compose_v2:
project_src: "/opt/stacks/{{ item }}"
state: present
loop: ['npm', 'authentik']

View File

@ -0,0 +1 @@
services: {}

View File

@ -0,0 +1 @@
services: {}

25
site.yml Normal file
View File

@ -0,0 +1,25 @@
---
- name: 1. Preparación Común
hosts: all
become: yes
roles:
- common
- name: 2. Despliegue Core
hosts: core_group
become: yes
roles:
- core
- name: 3. Despliegue Gateway
hosts: gateway_group
become: yes
roles:
- gateway
tasks:
- name: "INTEGRACIÓN: Añadir IP del Core al /etc/hosts del Gateway"
lineinfile:
path: /etc/hosts
line: "{{ hostvars[groups['core_group'][0]]['ansible_host'] }} alicante-core"
state: present