This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
# host_vars/localhost.yml
|
||||
# host_vars/ubuntu-test-2.yml
|
||||
# Host-spezifische Variablen — überschreiben group_vars und Rollen-Defaults.
|
||||
|
||||
nginx_port: 8080 # überschreibt die Default 80 aus defaults/main.yml
|
||||
@@ -4,5 +4,6 @@
|
||||
|
||||
all:
|
||||
hosts:
|
||||
localhost:
|
||||
ansible_connection: local # läuft direkt auf diesem Rechner (kein SSH)
|
||||
ubuntu-test-2:
|
||||
ansible_host: ubuntu-test-2 # per DNS/known_hosts auf man-dan-05 auflösbar
|
||||
ansible_user: jonnybravo
|
||||
|
||||
+4
-6
@@ -1,15 +1,13 @@
|
||||
---
|
||||
# site.yml — Haupt-Playbook
|
||||
# Ruft die Rolle "webserver" für localhost auf.
|
||||
# Ruft die Rolle "webserver" für ubuntu-test-2 auf.
|
||||
|
||||
- name: Webserver auf localhost konfigurieren
|
||||
hosts: localhost
|
||||
connection: local # Connection-Typ "local" (lokal) — "localhost" ist der HOST
|
||||
# es gibt keinen echten Host, zu dem man SSH-en könnte
|
||||
- name: Webserver auf ubuntu-test-2 konfigurieren
|
||||
hosts: ubuntu-test-2
|
||||
gather_facts: true # Facts sammeln (OS, IP, Hostname, …)
|
||||
become: true # mit sudo ausführen (für Paket-Installation)
|
||||
|
||||
roles:
|
||||
- role: webserver
|
||||
vars: # Playbook-Variablen (überschreibt Defaults)
|
||||
domain: localhost
|
||||
domain: ubuntu-test-2
|
||||
|
||||
Reference in New Issue
Block a user