diff --git a/ansible/deploy_all.yml b/ansible/deploy_all.yml index 01666f1..fe5a4bf 100644 --- a/ansible/deploy_all.yml +++ b/ansible/deploy_all.yml @@ -1,19 +1,36 @@ -- name: Infrastructure Deployment +--- +- name: Step 1 - Terraform Provisioning hosts: localhost + connection: local + gather_facts: false tasks: - name: Run Terraform Apply community.general.terraform: - project_path: "./terraform" + project_path: "./terraform" # путь к папке с .tf файлами в вашем репозитории state: present force_init: true - backend_config: - address: "{{ lookup('env', 'TF_HTTP_ADDRESS') }}" - username: "{{ lookup('env', 'TF_HTTP_USERNAME') }}" - password: "{{ lookup('env', 'TF_HTTP_PASSWORD') }}" + register: tf_result - - name: Wait for VMs to be ready - pause: - seconds: 30 + - 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: Kubernetes Cluster Setup - import_playbook: k8s_setup.yml \ No newline at end of file +- 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 \ No newline at end of file