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

This commit is contained in:
2025-12-28 10:08:33 +00:00
parent 91a91dc26a
commit 00ee4a21a4

View File

@@ -4,6 +4,8 @@
connection: local
gather_facts: false
become: false
vars:
tf_dir: "{{ playbook_dir }}/../terraform"
tasks:
- name: Create terraform mirror config
@@ -19,15 +21,15 @@
}
}
- name: Nuclear Cleanup
shell: "rm -rf .terraform .terraform.lock.hcl"
- name: Total Cleanup
shell: "rm -rf .terraform .terraform.lock.hcl terraform.tfstate*"
args:
chdir: "{{ playbook_dir }}/../terraform"
chdir: "{{ tf_dir }}"
- name: Terraform Init
shell: terraform init -reconfigure -no-color
args:
chdir: "{{ playbook_dir }}/../terraform"
chdir: "{{ tf_dir }}"
environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
TF_HTTP_ADDRESS: "{{ lookup('env', 'TF_HTTP_ADDRESS') }}"
@@ -37,8 +39,7 @@
- name: Terraform Apply
shell: terraform apply -auto-approve -no-color -lock=false
args:
chdir: "{{ playbook_dir }}/../terraform"
register: tf_result
chdir: "{{ tf_dir }}"
environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
TF_HTTP_ADDRESS: "{{ lookup('env', 'TF_HTTP_ADDRESS') }}"
@@ -48,6 +49,7 @@
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 Ansible memory
add_host:
name: "{{ item.name }}"