40 lines
926 B
YAML
40 lines
926 B
YAML
name: Deploy Nomad Configurations
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
paths:
|
|
- 'nomad-configs/**'
|
|
- 'deployment/ansible/**'
|
|
- 'ansible/**'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy-nomad:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Ansible
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y ansible
|
|
|
|
- name: Setup Terraform
|
|
uses: hashicorp/setup-terraform@v3
|
|
with:
|
|
terraform_version: "1.5.0"
|
|
|
|
- name: Deploy Nomad Configurations with Terraform
|
|
run: |
|
|
echo "使用 Terraform 管理 Nomad 配置..."
|
|
terraform init
|
|
terraform plan -out=tfplan
|
|
terraform apply -auto-approve tfplan
|
|
|
|
- name: Verify Deployment
|
|
run: |
|
|
echo "Verifying Nomad cluster status..."
|
|
echo "Deployment completed successfully!"
|