From 89f054e8fd0d5d0b55419e43ea4812daccdeb642 Mon Sep 17 00:00:00 2001 From: Sandwich Date: Fri, 1 Nov 2024 23:58:52 +0100 Subject: [PATCH] Add final check if the VM is up and running after reboot --- main.yml | 12 ++++++++++++ roles/cleanup/tasks/main.yml | 2 ++ 2 files changed, 14 insertions(+) diff --git a/main.yml b/main.yml index 560e050..c2e57d3 100644 --- a/main.yml +++ b/main.yml @@ -78,3 +78,15 @@ when: install_type == "virtual" vars: ansible_connection: local + + tasks: + - name: Set final SSH Credentials + when: hypervisor == 'vmware' and vmware_ssh | bool + ansible.builtin.set_fact: + ansible_user: "{{ user_name }}" + ansible_password: "{{ user_password }}" + ansible_become_password: "{{ user_password }}" + + - name: Check if VM is back and running + ansible.builtin.wait_for_connection: + timeout: 300 diff --git a/roles/cleanup/tasks/main.yml b/roles/cleanup/tasks/main.yml index 7fa9dbc..5d2a55f 100644 --- a/roles/cleanup/tasks/main.yml +++ b/roles/cleanup/tasks/main.yml @@ -1,6 +1,8 @@ --- - name: Shutdown the VM community.general.shutdown: + vars: + ansible_connection: ssh - name: Setup Cleanup when: hypervisor == "proxmox"