Обновить ansible/deploy_all.yml
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
content: |
|
content: |
|
||||||
provider_installation {
|
provider_installation {
|
||||||
network_mirror {
|
network_mirror {
|
||||||
url = "https://terraform-mirror.yandexcloud.net/"
|
url = "https://registry.tf-mirror.ru/"
|
||||||
}
|
}
|
||||||
direct {
|
direct {
|
||||||
exclude = ["registry.terraform.io/*/*"]
|
exclude = ["registry.terraform.io/*/*"]
|
||||||
@@ -24,31 +24,26 @@
|
|||||||
path: "{{ playbook_dir }}/../terraform/.terraform"
|
path: "{{ playbook_dir }}/../terraform/.terraform"
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
- name: Terraform Init
|
- name: Terraform Init and Apply
|
||||||
shell: terraform init -reconfigure -no-color
|
shell: |
|
||||||
|
terraform init -reconfigure -upgrade -no-color && \
|
||||||
|
terraform apply -auto-approve -no-color -lock=false
|
||||||
args:
|
args:
|
||||||
chdir: "{{ playbook_dir }}/../terraform"
|
chdir: "{{ playbook_dir }}/../terraform"
|
||||||
|
register: tf_output
|
||||||
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') }}"
|
||||||
TF_HTTP_USERNAME: "{{ lookup('env', 'TF_HTTP_USERNAME') }}"
|
TF_HTTP_USERNAME: "{{ lookup('env', 'TF_HTTP_USERNAME') }}"
|
||||||
TF_HTTP_PASSWORD: "{{ lookup('env', 'TF_HTTP_PASSWORD') }}"
|
TF_HTTP_PASSWORD: "{{ lookup('env', 'TF_HTTP_PASSWORD') }}"
|
||||||
|
|
||||||
- name: Terraform Apply
|
|
||||||
# МЫ ДОБАВИЛИ -lock=false, чтобы Gitea не ругалась на 405 ошибку
|
|
||||||
shell: terraform apply -auto-approve -no-color -lock=false
|
|
||||||
args:
|
|
||||||
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') }}"
|
|
||||||
# Прокидываем переменные для Proxmox
|
|
||||||
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') }}"
|
||||||
|
|
||||||
|
- name: Show Terraform Output
|
||||||
|
debug:
|
||||||
|
var: tf_output.stdout_lines
|
||||||
|
|
||||||
- name: Dynamically add hosts
|
- name: Dynamically add hosts
|
||||||
add_host:
|
add_host:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user