From 11f73e0be4a4ed6c34b289c58ae0e1922d621a7d Mon Sep 17 00:00:00 2001 From: master of disaster Date: Wed, 10 Dec 2025 23:25:51 +0100 Subject: [PATCH] first try --- .gitea/workflows/demo.yaml | 78 ++++++++++++++++++++++++++++++++++++++ .gitmodules | 10 +++++ inventory | 1 + roles/prometheus | 1 + 4 files changed, 90 insertions(+) create mode 100644 .gitea/workflows/demo.yaml create mode 100644 .gitmodules create mode 160000 inventory create mode 160000 roles/prometheus diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml new file mode 100644 index 0000000..f95ba46 --- /dev/null +++ b/.gitea/workflows/demo.yaml @@ -0,0 +1,78 @@ +name: Install Ansible + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + # Ermöglicht manuellen Start des Workflows über die GitHub UI + workflow_dispatch: + +jobs: + install_ansible: + runs-on: ubuntu-latest + + steps: + # - name: Konfiguriere SSH-Schlüssel in den Runner laden + # uses: webfactory/ssh-agent@v0.9.0 + # with: + # ssh-private-key: ${{ secrets.SSHKEY }} + # - name: Deaktiviere StrictHostKeyChecking für Gitea Host + # run: | + # # Ersetze DEIN_GITEA_HOST durch den Hostnamen deines Gitea-Servers + # DEIN_GITEA_HOST="gitea.mod.home" + # + # # Erstelle oder editiere die globale SSH-Konfiguration + # mkdir -p ~/.ssh + # echo "Host $DEIN_GITEA_HOST" >> ~/.ssh/config + # echo " StrictHostKeyChecking no" >> ~/.ssh/config + # echo " UserKnownHostsFile /dev/null" >> ~/.ssh/config + # + # # Optional: Gib die Konfiguration aus, um sie zu prüfen + # cat ~/.ssh/config + - name: Setup SSH for submodules + run: | + echo "Key length: ${#SSH_PRIVATE_KEY}" + mkdir -p $HOME/.ssh + echo "$SSH_PRIVATE_KEY" | base64 -d > $HOME/.ssh/id_ed25519 + chmod 600 $HOME/.ssh/id_ed25519 + ls -laR + # ssh-keyscan -t rsa -p 2222 gitlab.mod.home > $HOME/.ssh/known_hosts + echo "Host *" >> ~/.ssh/config + echo " StrictHostKeyChecking no" >> ~/.ssh/config + echo " UserKnownHostsFile /dev/null" >> ~/.ssh/config + env: + SSH_PRIVATE_KEY: ${{ secrets.SSHKEY_B64 }} + - name: Checkout Repository + uses: actions/checkout@v4 + submodules: recursive + fetch-depth: 0 + # Python 3 installieren, was für pip und Ansible notwendig ist + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' # Wählt die neueste Python 3 Version + + # Abhängigkeiten aktualisieren und Ansible über pip installieren + - name: Install Ansible via pip + run: | + python -m pip install --upgrade pip + pip install ansible + + # vault file anlegen + - name: create vault file + run: echo "${{ secrets.ANSIBLE_VAULT_KEY }}" > .vault_pass.txt + - name: Manuelles Submodule Update + run: | + git submodule init + # Hier wird der SSH-Fehler wahrscheinlich auftreten + git submodule update --recursive --init --force + # Optional: Version prüfen, um die erfolgreiche Installation zu bestätigen + - name: Verify Ansible Installation + run: ansible --version + - name: Validate Ansible inventory + run: | + SUBMODULE_FOLDER="inventory" + ansible-inventory --graph + - name: list inventory directory + run: ls -R . diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..baa2b7f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,10 @@ +[submodule "inventory"] + path = inventory + url = ssh://gitea@gitea.mod.home:2222/ansible/inventory.git + branch = main + +[submodule "prometheus"] + path = roles/prometheus + url = ssh://gitea@gitea.mod.home:2222/ansible-monitoring/prometheus.git + branch = main + diff --git a/inventory b/inventory new file mode 160000 index 0000000..77e8406 --- /dev/null +++ b/inventory @@ -0,0 +1 @@ +Subproject commit 77e840672e3bed58df0a7f266d623fad76020eb4 diff --git a/roles/prometheus b/roles/prometheus new file mode 160000 index 0000000..9200bda --- /dev/null +++ b/roles/prometheus @@ -0,0 +1 @@ +Subproject commit 9200bda832e32d8829e539d9f274d6697a8b4a3e