From df40793c120d82b0c3b949ff91b8117c4f445f30 Mon Sep 17 00:00:00 2001
From: Von Random <von@mechanus.net>
Date: Mon, 20 Jan 2025 00:10:37 +0200
Subject: [PATCH] add wait for ssh to the playbook

---
 ansible/ansible.cfg     |  1 +
 ansible/nginx_setup.yml | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg
index 51eb0db..86bb97f 100644
--- a/ansible/ansible.cfg
+++ b/ansible/ansible.cfg
@@ -1,5 +1,6 @@
 [defaults]
 inventory = inventory.yml
+interpreter_python = /usr/bin/python3
 
 remote_user = andrei
 private_key_file = id_ed25519_yatf
diff --git a/ansible/nginx_setup.yml b/ansible/nginx_setup.yml
index 4f23fb1..5c8dc22 100644
--- a/ansible/nginx_setup.yml
+++ b/ansible/nginx_setup.yml
@@ -1,9 +1,16 @@
 ---
+- name: Wait for ssh
+  gather_facts: false
+  hosts: all
+  tasks:
+    - name: check 22/tcp
+      ansible.builtin.wait_for:
+        port: 22
+        connect_timeout: 30
+  
 - name: Configure nginx
   become: true
   hosts: all
-  vars:
-    ansible_python_interpreter: /usr/bin/python3
   tasks:
     - name: install nginx
       ansible.builtin.apt: