52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
---
|
|
- name: Step 1 - Terraform Provisioning
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: false # <--- ТЕПЕРЬ СТРОГО FALSE
|
|
become: false # <--- ТЕПЕРЬ СТРОГО FALSE
|
|
|
|
tasks:
|
|
- name: Create terraform mirror config
|
|
copy:
|
|
dest: "/tmp/.terraformrc"
|
|
content: |
|
|
provider_installation {
|
|
network_mirror {
|
|
url = "https://terraform-mirror.yandexcloud.net/"
|
|
}
|
|
direct {
|
|
exclude = ["registry.terraform.io/*/*"]
|
|
}
|
|
}
|
|
|
|
- name: Clean old terraform
|
|
file:
|
|
path: "{{ playbook_dir }}/../terraform/.terraform"
|
|
state: absent
|
|
|
|
- name: Terraform Init
|
|
shell: terraform init -reconfigure -no-color
|
|
args:
|
|
chdir: "{{ playbook_dir }}/../terraform"
|
|
environment:
|
|
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
|
|
TF_HTTP_USERNAME: "{{ lookup('env', 'TF_HTTP_USERNAME') }}"
|
|
TF_HTTP_PASSWORD: "{{ lookup('env', 'TF_HTTP_PASSWORD') }}"
|
|
|
|
- name: Terraform Apply
|
|
shell: terraform apply -auto-approve -no-color
|
|
args:
|
|
chdir: "{{ playbook_dir }}/../terraform"
|
|
environment:
|
|
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_secret: "{{ lookup('env', 'TF_VAR_proxmox_api_token_secret') }}"
|
|
TF_VAR_proxmox_api_url: "{{ lookup('env', 'TF_VAR_proxmox_api_url') }}"
|
|
|
|
- name: Step 2 - Install Kubernetes
|
|
hosts: all
|
|
gather_facts: true # Тут факты нужны, так как это реальные серверы
|
|
become: true # Тут sudo нужно
|
|
tasks:
|
|
- name: Test Connection
|
|
ping: |