gitea action
Ansible Deploy (ubuntu-test-2) / deploy (push) Successful in 8s

This commit is contained in:
2026-10-14 10:39:57 +02:00
parent 3ceae1bf83
commit 05968a9db9
4 changed files with 24 additions and 9 deletions
+16
View File
@@ -0,0 +1,16 @@
name: Ansible Deploy (ubuntu-test-2)
on:
push:
branches: [master, main]
workflow_dispatch:
jobs:
deploy:
runs-on: shell
steps:
- name: Playbook auf ubuntu-test-2 ausführen
run: |
export SSH_AUTH_SOCK="$(ls -t /home/jonnybravo/.ssh/agent/s.*.agent.* 2>/dev/null | head -1)"
PATH="/home/jonnybravo/.local/bin:$PATH" ansible-playbook site.yml
working-directory: /home/jonnybravo/ansible_präsentation/Beispiel
@@ -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
+3 -2
View File
@@ -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
View File
@@ -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