Files
IaC/ansible/deploy_all.yml

39 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
- name: Step 1 - Terraform Provisioning
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Run Terraform Apply
community.general.terraform:
project_path: "{{ playbook_dir }}/../terraform" # путь к папке с .tf файлами в вашем репозитории
state: present
force_init: true
init_reconfigure: true
environment:
TF_CLI_CONFIG_FILE: "/tmp/.terraformrc"
register: tf_result
- name: Wait for SSH to be ready
wait_for:
host: "{{ item }}"
port: 22
state: started
timeout: 300
loop:
- 10.33.33.201
- 10.33.33.202
- 10.33.33.203
- name: Step 2 - Install Kubernetes
hosts: all
# Теперь мы переключаемся на реальные сервера.
# Чтобы это сработало в одном шаблоне,
# в Semaphore должен быть выбран Inventory со всеми хостами,
# НО в первом Play мы принудительно используем localhost.
become: true
tasks:
- name: Install base packages
apt:
name: [curl, apt-transport-https]
state: present