From 87cfd4c804505a43c5d361648aa175d8de79213f Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Wed, 19 Nov 2025 09:37:43 +0100 Subject: [PATCH 1/6] Added yml --- misc/example-certs.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 misc/example-certs.yml diff --git a/misc/example-certs.yml b/misc/example-certs.yml new file mode 100644 index 0000000..715d324 --- /dev/null +++ b/misc/example-certs.yml @@ -0,0 +1,24 @@ +- name: test para autenticar en máquina con certificado + hosts: all + become: yes + vars: + domain_name: "example.com" + cert_path: "/etc/ssl/certs/example.com.crt" + key_path: "/etc/ssl/private/example.com.key" + tasks: + - name: Asegurarse que existe la clave dominio + community.crypto.openssl_privatekey: + path: "{{ key_path }}" + size: 2048 + state: present + + - name: Obtener certificado via ACME (Let's Encrypt) + community.crypto.acme_certificate: + account_key_src: "/etc/ssl/private/account.key" + csr: + common_name: "{{ domain_name }}" + fullchain_dest: "{{ cert_path }}" + privatekey_dest: "{{ key_path }}" + provider: letsencrypt + terms_agreed: true + state: present \ No newline at end of file From 0c701d325173c63e0c01e8c4614de3a2312eb153 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Wed, 19 Nov 2025 13:36:00 +0100 Subject: [PATCH 2/6] Added hosts.yaml --- training/hosts.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 training/hosts.yaml diff --git a/training/hosts.yaml b/training/hosts.yaml new file mode 100644 index 0000000..60d8044 --- /dev/null +++ b/training/hosts.yaml @@ -0,0 +1,24 @@ +all: + ansible_python_interpreter: /usr/bin/python3.12 + +database: + hosts: + db_01: + ansible_host: 192.168.11.20 + ansible_connection: ssh + ansible_user: vagrant + ansible_ssh_password: vagrant +loadbalancer: + hosts: + lb_01: + ansible_host: 192.168.11.30 + ansible_connection: ssh + ansible_user: vagrant + ansible_ssh_password: vagrant +webserver: + hosts: + db_01: + ansible_host: 192.168.11.40 + ansible_connection: ssh + ansible_user: vagrant + ansible_ssh_password: vagrant \ No newline at end of file From fea764fb951e509990a13f10e5a070517deaf8d3 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Wed, 19 Nov 2025 13:38:01 +0100 Subject: [PATCH 3/6] Added hosts-yaml --- training/hosts.yaml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 training/hosts.yaml diff --git a/training/hosts.yaml b/training/hosts.yaml deleted file mode 100644 index 60d8044..0000000 --- a/training/hosts.yaml +++ /dev/null @@ -1,24 +0,0 @@ -all: - ansible_python_interpreter: /usr/bin/python3.12 - -database: - hosts: - db_01: - ansible_host: 192.168.11.20 - ansible_connection: ssh - ansible_user: vagrant - ansible_ssh_password: vagrant -loadbalancer: - hosts: - lb_01: - ansible_host: 192.168.11.30 - ansible_connection: ssh - ansible_user: vagrant - ansible_ssh_password: vagrant -webserver: - hosts: - db_01: - ansible_host: 192.168.11.40 - ansible_connection: ssh - ansible_user: vagrant - ansible_ssh_password: vagrant \ No newline at end of file From 3d4e765b387ee652962697fffbcf00ced99afec4 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Wed, 19 Nov 2025 13:38:10 +0100 Subject: [PATCH 4/6] Added hosts-yaml 2 --- misc/hosts-yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 misc/hosts-yaml diff --git a/misc/hosts-yaml b/misc/hosts-yaml new file mode 100644 index 0000000..60d8044 --- /dev/null +++ b/misc/hosts-yaml @@ -0,0 +1,24 @@ +all: + ansible_python_interpreter: /usr/bin/python3.12 + +database: + hosts: + db_01: + ansible_host: 192.168.11.20 + ansible_connection: ssh + ansible_user: vagrant + ansible_ssh_password: vagrant +loadbalancer: + hosts: + lb_01: + ansible_host: 192.168.11.30 + ansible_connection: ssh + ansible_user: vagrant + ansible_ssh_password: vagrant +webserver: + hosts: + db_01: + ansible_host: 192.168.11.40 + ansible_connection: ssh + ansible_user: vagrant + ansible_ssh_password: vagrant \ No newline at end of file From 502e4479c07afbad3441a002b1afe02f37545929 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Wed, 19 Nov 2025 13:40:13 +0100 Subject: [PATCH 5/6] Added hosts-yaml 3 --- misc/hosts-yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/hosts-yaml b/misc/hosts-yaml index 60d8044..3cdde42 100644 --- a/misc/hosts-yaml +++ b/misc/hosts-yaml @@ -17,7 +17,7 @@ loadbalancer: ansible_ssh_password: vagrant webserver: hosts: - db_01: + ws_01: ansible_host: 192.168.11.40 ansible_connection: ssh ansible_user: vagrant From 9c771dee28028fb1f0455504af5ed0bc5b97bfd0 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Wed, 19 Nov 2025 13:47:26 +0100 Subject: [PATCH 6/6] Added hosts-yaml 4 --- misc/hosts-yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/misc/hosts-yaml b/misc/hosts-yaml index 3cdde42..9c2740f 100644 --- a/misc/hosts-yaml +++ b/misc/hosts-yaml @@ -21,4 +21,9 @@ webserver: ansible_host: 192.168.11.40 ansible_connection: ssh ansible_user: vagrant + ansible_ssh_password: vagrant + ws_02: + ansible_host: 192.168.11.50 + ansible_connection: ssh + ansible_user: vagrant ansible_ssh_password: vagrant \ No newline at end of file