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

This commit is contained in:
2025-12-28 09:28:32 +00:00
parent 22fe443114
commit 6faf0751e1

View File

@@ -2,8 +2,8 @@
- name: Step 1 - Terraform Provisioning
hosts: localhost
connection: local
gather_facts: false # <--- ТЕПЕРЬ СТРОГО FALSE
become: false # <--- ТЕПЕРЬ СТРОГО FALSE
gather_facts: false
become: false
tasks:
- name: Create terraform mirror config
@@ -30,6 +30,7 @@
chdir: "{{ playbook_dir }}/../terraform"
environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
TF_HTTP_ADDRESS: "{{ lookup('env', 'TF_HTTP_ADDRESS') }}"
TF_HTTP_USERNAME: "{{ lookup('env', 'TF_HTTP_USERNAME') }}"
TF_HTTP_PASSWORD: "{{ lookup('env', 'TF_HTTP_PASSWORD') }}"
@@ -43,10 +44,31 @@
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') }}"
- name: Dynamically add hosts to inventory
add_host:
name: "{{ item }}"
groups: k8s_new_nodes
ansible_host: "{{ item }}"
ansible_user: ubuntu # Или тот пользователь, которого ты создал в Cloud-Init
loop:
- 10.33.33.201
- 10.33.33.202
- 10.33.33.203
- name: Step 2 - Install Kubernetes
hosts: all
gather_facts: true # Тут факты нужны, так как это реальные серверы
become: true # Тут sudo нужно
hosts: k8s_new_nodes # <--- Теперь используем динамическую группу
gather_facts: true
become: true
tasks:
- name: Wait for SSH
wait_for_connection:
timeout: 300
- name: Test Connection
ping:
- name: Install base packages
apt:
name: [curl, apt-transport-https, qemu-guest-agent]
state: present
update_cache: yes