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

This commit is contained in:
2025-12-28 09:21:58 +00:00
parent 9e6d64288d
commit 22fe443114

View File

@@ -2,19 +2,13 @@
- name: Step 1 - Terraform Provisioning - name: Step 1 - Terraform Provisioning
hosts: localhost hosts: localhost
connection: local connection: local
gather_facts: false # <--- ОТКЛЮЧАЕМ автоматический сбор фактов gather_facts: false # <--- ТЕПЕРЬ СТРОГО FALSE
become: false # <--- ПРИНУДИТЕЛЬНО отключаем sudo become: false # <--- ТЕПЕРЬ СТРОГО FALSE
vars:
tf_dir: "{{ playbook_dir }}/../terraform"
tasks:
# Если нам всё же нужны данные о системе, собираем их без sudo
- name: Manual fact gathering without sudo
setup:
become: false
tasks:
- name: Create terraform mirror config - name: Create terraform mirror config
copy: copy:
dest: "/tmp/.terraformrc" # Используем /tmp, так как в контейнере права туда есть всегда dest: "/tmp/.terraformrc"
content: | content: |
provider_installation { provider_installation {
network_mirror { network_mirror {
@@ -25,15 +19,15 @@
} }
} }
- name: Cleanup old terraform data - name: Clean old terraform
file: file:
path: "{{ tf_dir }}/.terraform" path: "{{ playbook_dir }}/../terraform/.terraform"
state: absent state: absent
- name: Terraform Init - name: Terraform Init
shell: terraform init -reconfigure -no-color shell: terraform init -reconfigure -no-color
args: args:
chdir: "{{ tf_dir }}" chdir: "{{ playbook_dir }}/../terraform"
environment: environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc" TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
TF_HTTP_USERNAME: "{{ lookup('env', 'TF_HTTP_USERNAME') }}" TF_HTTP_USERNAME: "{{ lookup('env', 'TF_HTTP_USERNAME') }}"
@@ -42,7 +36,7 @@
- name: Terraform Apply - name: Terraform Apply
shell: terraform apply -auto-approve -no-color shell: terraform apply -auto-approve -no-color
args: args:
chdir: "{{ tf_dir }}" chdir: "{{ playbook_dir }}/../terraform"
environment: environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc" TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
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') }}"
@@ -51,10 +45,8 @@
- name: Step 2 - Install Kubernetes - name: Step 2 - Install Kubernetes
hosts: all hosts: all
become: true # Для реальных серверов sudo всё еще нужно gather_facts: true # Тут факты нужны, так как это реальные серверы
become: true # Тут sudo нужно
tasks: tasks:
- name: Install base packages - name: Test Connection
apt: ping:
name: [curl, apt-transport-https, qemu-guest-agent]
state: present
update_cache: yes