From 19506efea08e4c40f63c5efdecc7a6c27a09aa14 Mon Sep 17 00:00:00 2001 From: sky-joker Date: Sun, 24 Jan 2021 16:46:35 +0900 Subject: [PATCH] Add processing to check the status of vmware tools to linux instance creation tasks (#5) * add processing to check the status of vmware tools to linux instance creation tasks * add snapshot_src description to molecule.yml --- .../create_linux_instance.yml | 16 ++++++++++++++++ .../{{cookiecutter.scenario_name}}/molecule.yml | 1 + 2 files changed, 17 insertions(+) diff --git a/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create_linux_instance.yml b/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create_linux_instance.yml index e9bb3e3..03a78e7 100644 --- a/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create_linux_instance.yml +++ b/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create_linux_instance.yml @@ -42,6 +42,22 @@ delay: 10 retries: 300 +- name: Check vmware tools status + vmware_guest_info: + hostname: "{{ molecule_yml.driver.vcenter_hostname }}" + username: "{{ molecule_yml.driver.vcenter_username }}" + password: "{{ molecule_yml.driver.vcenter_password }}" + validate_certs: "{{ molecule_yml.driver.validate_certs | default(false) }}" + datacenter: "{{ molecule_yml.driver.datacenter }}" + folder: "{{ molecule_yml.driver.folder }}" + name: "{{ item.name }}" + register: guest_state + until: "guest_state.instance.guest_tools_status == 'guestToolsRunning'" + delay: 10 + retries: 300 + loop: "{{ molecule_yml.platforms }}" + ignore_errors: true + - name: Create ssh directory and public key in guest OS vmware_vm_shell: hostname: "{{ molecule_yml.driver.vcenter_hostname }}" diff --git a/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml b/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml index 716dc99..0693716 100644 --- a/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml +++ b/molecule_vmware/cookiecutter/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml @@ -22,6 +22,7 @@ driver: platforms: - name: instance # is an instance name template: change me to template name # is to be used as a template when cloning an instance + #snapshot_src: change me to snapshot name # is a snapshot name to be possible specified if you want to use linked clone. hardware: num_cpus: 2 # is cpu number to be configured to an instance memory_mb: 2048 # is memory size(MB) to be configured to an instance