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

This commit is contained in:
2025-12-28 09:31:27 +00:00
parent c5ee22fc79
commit 7093637cff

View File

@@ -40,6 +40,9 @@
chdir: "{{ playbook_dir }}/../terraform" chdir: "{{ playbook_dir }}/../terraform"
environment: environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc" 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') }}"
TF_VAR_proxmox_api_token_id: "{{ lookup('env', 'TF_VAR_proxmox_api_token_id') }}" TF_VAR_proxmox_api_token_id: "{{ lookup('env', 'TF_VAR_proxmox_api_token_id') }}"
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') }}"
@@ -49,26 +52,32 @@
name: "{{ item }}" name: "{{ item }}"
groups: k8s_new_nodes groups: k8s_new_nodes
ansible_host: "{{ item }}" ansible_host: "{{ item }}"
ansible_user: ubuntu # Или тот пользователь, которого ты создал в Cloud-Init ansible_user: ubuntu
loop: loop:
- 10.33.33.201 - 10.33.33.201
- 10.33.33.202 - 10.33.33.202
- 10.33.33.203 - 10.33.33.203
- name: Step 2 - Install Kubernetes - name: Step 2 - Install Kubernetes
hosts: k8s_new_nodes # <--- Теперь используем динамическую группу hosts: k8s_new_nodes
gather_facts: true gather_facts: false # Сначала выключим, чтобы дождаться SSH
become: true
tasks: tasks:
- name: Wait for SSH - name: Wait for SSH to be ready
wait_for_connection: wait_for:
host: "{{ inventory_hostname }}"
port: 22
state: started
timeout: 300 timeout: 300
delegate_to: localhost
become: false
- name: Test Connection - name: Now gather facts
ping: setup:
become: true
- name: Install base packages - name: Install base packages
apt: apt:
name: [curl, apt-transport-https, qemu-guest-agent] name: [curl, apt-transport-https, qemu-guest-agent]
state: present state: present
update_cache: yes update_cache: yes
become: true