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