ansible kafka test #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ansible Kafka Cluster Installation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'ansible_kafka_cluster/**' | |
| jobs: | |
| ansible: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Run Ansible in Docker | |
| run: | | |
| docker run --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| -w /workspace \ | |
| -e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \ | |
| -e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | |
| -e SSH_PRIVATE_KEY="${{ secrets.EC2 }}" \ | |
| -e ADMIN_PASSWORD="${{ secrets.ADMIN_PASSWORD }}" \ | |
| python:3.11-slim bash -c " | |
| set -e | |
| # Sistem paketlerini kur | |
| apt-get update && apt-get install -y ansible awscli jq ssh git | |
| # Confluent Platform koleksiyonunu yükle | |
| ansible-galaxy collection install confluent.platform | |
| # SSH key oluştur ve izinleri ayarla | |
| mkdir -p ~/.ssh | |
| echo \"\$SSH_PRIVATE_KEY\" > ~/.ssh/trendyol-kafka-key.pem | |
| chmod 600 ~/.ssh/trendyol-kafka-key.pem | |
| # Inventory oluştur | |
| bash ansible_kafka_cluster/generate-ansible-inventory.sh | |
| # Test ping | |
| ansible all -i ansible_kafka_cluster/inventory.yml -m ping | |
| # Playbook çalıştır | |
| ansible-playbook -i ansible_kafka_cluster/cp-ansible-inventory.yml confluent.platform.all | |
| " |