Обновить ansible/deploy_all.yml

This commit is contained in:
2025-12-28 00:39:32 +00:00
parent 0d62c65862
commit 4c21116d6e

View File

@@ -1,19 +1,36 @@
- name: Infrastructure Deployment
---
- name: Step 1 - Terraform Provisioning
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Run Terraform Apply
community.general.terraform:
project_path: "./terraform"
project_path: "./terraform" # путь к папке с .tf файлами в вашем репозитории
state: present
force_init: true
backend_config:
address: "{{ lookup('env', 'TF_HTTP_ADDRESS') }}"
username: "{{ lookup('env', 'TF_HTTP_USERNAME') }}"
password: "{{ lookup('env', 'TF_HTTP_PASSWORD') }}"
register: tf_result
- name: Wait for VMs to be ready
pause:
seconds: 30
- name: Wait for SSH to be ready
wait_for:
host: "{{ item }}"
port: 22
state: started
timeout: 300
loop:
- 10.33.33.201
- 10.33.33.202
- 10.33.33.203
- name: Kubernetes Cluster Setup
import_playbook: k8s_setup.yml
- name: Step 2 - Install Kubernetes
hosts: all
# Теперь мы переключаемся на реальные сервера.
# Чтобы это сработало в одном шаблоне,
# в Semaphore должен быть выбран Inventory со всеми хостами,
# НО в первом Play мы принудительно используем localhost.
become: true
tasks:
- name: Install base packages
apt:
name: [curl, apt-transport-https]
state: present