-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.16 KB
/
ansible-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Configure Kubernetes Master Node
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
jobs:
configure-master:
runs-on: ubuntu-latest
steps:
# Schritt 1: Repository auschecken
- name: Checkout repository
uses: actions/checkout@v3
# Schritt 2: Installiere Ansible
- name: Install Ansible
run: |
sudo apt update
sudo apt install -y ansible
# Schritt 3: Setup SSH Key
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
shell: bash
# Schritt 4: Füge die Master-Node zur known_hosts-Datei hinzu
- name: Add server to known hosts
run: |
echo "Adding server ${{ vars.MASTER_NODE_IP }} to the known hosts"
ssh-keyscan -H ${{ vars.MASTER_NODE_IP }} >> ~/.ssh/known_hosts
# Schritt 5: Führe das Ansible-Playbook aus
- name: Run Ansible Playbook
working-directory: ops/ansible
run: |
ansible-playbook -i ${{ vars.MASTER_NODE_IP }}, -u ${{ vars.MASTER_NODE_USER }} playbooks/master-setup.yml