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

This commit is contained in:
2025-12-28 09:57:41 +00:00
parent 24d30805c5
commit da066bd7fc

View File

@@ -48,29 +48,29 @@
TF_VAR_proxmox_api_token_secret: "{{ lookup('env', 'TF_VAR_proxmox_api_token_secret') }}" TF_VAR_proxmox_api_token_secret: "{{ lookup('env', 'TF_VAR_proxmox_api_token_secret') }}"
TF_VAR_proxmox_api_url: "{{ lookup('env', 'TF_VAR_proxmox_api_url') }}" TF_VAR_proxmox_api_url: "{{ lookup('env', 'TF_VAR_proxmox_api_url') }}"
- name: Show Apply Output - name: Dynamically add hosts to Ansible memory
debug:
var: tf_result.stdout_lines
- name: Step 2 - Dynamic Inventory & Setup
hosts: localhost
connection: local
tasks:
- name: Add hosts
add_host: add_host:
name: "{{ item }}" name: "{{ item.name }}"
groups: k8s_new_nodes groups:
ansible_host: "{{ item }}" - k8s_new_nodes
ansible_user: ubuntu - "{{ 'masters' if 'master' in item.name else 'workers' }}"
loop: [10.33.33.201, 10.33.33.202, 10.33.33.203] ansible_host: "{{ item.ip }}"
ansible_user: ubuntu # ИСПОЛЬЗУЕМ ubuntu ИЗ CLOUD-INIT
ansible_ssh_extra_args: "-o StrictHostKeyChecking=no"
loop:
- { name: 'master-01', ip: '10.33.33.201' }
- { name: 'worker-01', ip: '10.33.33.202' }
- { name: 'worker-02', ip: '10.33.33.203' }
- name: Step 3 - K8s Setup - name: Step 2 - Wait for SSH and Prepare
hosts: k8s_new_nodes hosts: k8s_new_nodes
gather_facts: false gather_facts: false
tasks: tasks:
- name: Wait for SSH - name: Wait for SSH to be ready on new VMs
wait_for: wait_for_connection:
host: "{{ inventory_hostname }}" delay: 10
port: 22
timeout: 300 timeout: 300
delegate_to: localhost
# Step 3 - Запускаем твой основной плейбук установки K8s
- name: Step 3 - Install Kubernetes Cluster
import_playbook: k8s_setup.yml