From 2a7837ce8f9ab8ff61526056f287d5844241d7f5 Mon Sep 17 00:00:00 2001 From: Danielle Barda Date: Sun, 3 Mar 2024 12:45:21 +0200 Subject: [PATCH] fixing CI Signed-off-by: Danielle Barda --- playbooks/provision_vm/manage_vm.yml | 4 +- .../provisioning_vm_from_template.yml | 4 +- .../provision_vm/provisioning_vm_from_vm.yml | 5 +-- roles/create_vm_template/tasks/main.yml | 5 --- roles/provision_vm/README.md | 10 ++--- roles/provision_vm/tasks/main.yml | 40 +++++++++---------- 6 files changed, 31 insertions(+), 37 deletions(-) diff --git a/playbooks/provision_vm/manage_vm.yml b/playbooks/provision_vm/manage_vm.yml index 70d52711..f2d3b7f1 100644 --- a/playbooks/provision_vm/manage_vm.yml +++ b/playbooks/provision_vm/manage_vm.yml @@ -5,5 +5,5 @@ roles: - role: cloud.vmware_ops.provision_vm vars: - clone_from_template: false - clone_from_vm: false \ No newline at end of file + provision_vm_clone_from_template: false + provision_vm_clone_from_vm: false diff --git a/playbooks/provision_vm/provisioning_vm_from_template.yml b/playbooks/provision_vm/provisioning_vm_from_template.yml index 7c20fe2c..3aa0603f 100644 --- a/playbooks/provision_vm/provisioning_vm_from_template.yml +++ b/playbooks/provision_vm/provisioning_vm_from_template.yml @@ -5,5 +5,5 @@ roles: - role: cloud.vmware_ops.provision_vm vars: - clone_from_template: true - clone_from_vm: false + provision_vm_clone_from_template: true + provision_vm_clone_from_vm: false diff --git a/playbooks/provision_vm/provisioning_vm_from_vm.yml b/playbooks/provision_vm/provisioning_vm_from_vm.yml index ee37205c..d235e031 100644 --- a/playbooks/provision_vm/provisioning_vm_from_vm.yml +++ b/playbooks/provision_vm/provisioning_vm_from_vm.yml @@ -5,6 +5,5 @@ roles: - role: cloud.vmware_ops.provision_vm vars: - clone_from_template: false - clone_from_vm: true - + provision_vm_clone_from_template: false + provision_vm_clone_from_vm: true diff --git a/roles/create_vm_template/tasks/main.yml b/roles/create_vm_template/tasks/main.yml index 4fc1bd7c..e69de29b 100644 --- a/roles/create_vm_template/tasks/main.yml +++ b/roles/create_vm_template/tasks/main.yml @@ -1,5 +0,0 @@ ---- -# vm name or vm template -- name: Create VM or template - ansible.builtin.include_tasks: "clone_vm_to_template.yml" - diff --git a/roles/provision_vm/README.md b/roles/provision_vm/README.md index 61a137d6..9293a16b 100644 --- a/roles/provision_vm/README.md +++ b/roles/provision_vm/README.md @@ -1,5 +1,5 @@ # Provision virtual machine -A role to provision a virtual machine, create associated resources if they don’t exist (subnets, vCPU, memory configuration, storage configuration, etc) +A role to provision a virtual machine, create associated resources if they don't exist (subnets, vCPU, memory configuration, storage configuration, etc) This includes cloning and building from VM templates. @@ -73,7 +73,7 @@ N/A - **provision_vm_folder** (string): Destination folder, absolute path to find an existing guest or create the new guest. - The folder should include the datacenter. ESXi’s datacenter is ha-datacenter. + The folder should include the datacenter. ESXi's datacenter is ha-datacenter. This parameter is case sensitive. If multiple machines are found with same name, this parameter is used to identify uniqueness of the virtual machine. @@ -415,7 +415,7 @@ N/A Valid values are referenced here: https://code.vmware.com/apis/358/doc/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html - **provision_vm_hardware** (dictionary): - Manage virtual machine’s hardware attributes. + Manage virtual machine's hardware attributes. All parameters case sensitive. Keys: * hotadd_cpu: @@ -532,7 +532,7 @@ N/A - **provision_vm_state** (string): Specify the state the virtual machine should be in. If present and virtual machine exists, ensure the virtual machine configurations conforms to task arguments. - If absent and virtual machine exists, then the specified virtual machine is removed with it’s associated components. + If absent and virtual machine exists, then the specified virtual machine is removed with it's associated components. If set to one of poweredon, powered-on, poweredoff, powered-off, present, restarted, suspended and virtual machine does not exists, virtual machine is deployed with the given parameters. If set to poweredon or powered-on and virtual machine exists with powerstate other than powered on, then the specified virtual machine is powered on. If set to poweredoff or powered-off and virtual machine exists with powerstate other than powered off, then the specified virtual machine is powered off. @@ -612,7 +612,7 @@ N/A A list of networks (in the order of the NICs). Removing NICs is not allowed, while reconfiguring the virtual machine. All parameters and VMware object names are case sensitive. - The type, ip, netmask, gateway, domain, dns_servers options don’t set to a guest when creating a blank new virtual machine. They are set by the customization via vmware-tools. If you want to set the value of the options to a guest, you need to clone from a template with installed OS and vmware-tools(also Perl when Linux). + The type, ip, netmask, gateway, domain, dns_servers options don't set to a guest when creating a blank new virtual machine. They are set by the customization via vmware-tools. If you want to set the value of the options to a guest, you need to clone from a template with installed OS and vmware-tools(also Perl when Linux). Element keys: * name: type: str diff --git a/roles/provision_vm/tasks/main.yml b/roles/provision_vm/tasks/main.yml index cdae516d..b76f3978 100644 --- a/roles/provision_vm/tasks/main.yml +++ b/roles/provision_vm/tasks/main.yml @@ -1,12 +1,12 @@ --- -- name: Fail if cluster and esxi_hostname both weren't set or both were set - when: ("{{ cluster }}" is defined and "{{ esxi_hostname }}" is defined) or ("{{ cluster }}" is not defined and "{{ esxi_hostname }}" is not defined) +- name: Fail if provision_vm_cluster and provision_vm_esxi_hostname both weren't set or both were set + when: ( "{{ provision_vm_cluster }} " is defined and "{{ provision_vm_esxi_hostname }}" is defined ) or ( "{{ provision_vm_cluster }}" is not defined and "{{ provision_vm_esxi_hostname }}" is not defined) ansible.builtin.fail: - msg: esxi_hostname and cluster are mutually exclusive parameters + msg: provision_vm_esxi_hostname and provision_vm_cluster are mutually exclusive parameters - name: Create or update the VM community.vmware.vmware_guest: - hostname: "{{ provision_vm_hostname }}" + hostname: "{{ provision_vm_hostname }}" username: "{{ provision_vm_username }}" password: "{{ provision_vm_password }}" validate_certs: "{{ omit if provision_vm_validate_certs is not defined else provision_vm_validate_certs}}" @@ -20,11 +20,11 @@ # compute resource: cluster: "{{ omit if provision_vm_cluster not defined else provision_vm_cluster }}" - esxi_hostname: "{{ omit if provision_vm_esxi_hostname is not defined else provision_vm_esxi_hostname}}" - datacenter: "{{ omit if provision_vm_datacenter is not defined else provision_vm_datacenter}}" - folder: "{{ omit if provision_vm_folder is not defined else provision_vm_folder}}" - datastore: "{{ omit if provision_vm_datastore is not defined else provision_vm_datastore}}" - resource_pool: "{{ omit if provision_vm_resource_pool is not defined else provision_vm_resource_pool}}" + esxi_hostname: "{{ omit if provision_vm_esxi_hostname is not defined else provision_vm_esxi_hostname }}" + datacenter: "{{ omit if provision_vm_datacenter is not defined else provision_vm_datacenter }}" + folder: "{{ omit if provision_vm_folder is not defined else provision_vm_folder }}" + datastore: "{{ omit if provision_vm_datastore is not defined else provision_vm_datastore }}" + resource_pool: "{{ omit if provision_vm_resource_pool is not defined else provision_vm_resource_pool }}" # for cloning VM template: "{{ provision_vm_template }}" @@ -33,8 +33,8 @@ snapshot_src: "{{ omit if provision_vm_snapshot_src is not defined else provision_vm_snapshot_src }}" # optional: - advanced_settings: "{{ omit if provision_vm_advanced_settings is not defined else provision_vm_advanced_settings}}" - annotation: "{{ omit if provision_vm_annotation is not defined else provision_vm_annotation}}" + advanced_settings: "{{ omit if provision_vm_advanced_settings is not defined else provision_vm_advanced_settings }}" + annotation: "{{ omit if provision_vm_annotation is not defined else provision_vm_annotation }}" cdrom: "{{ omit if provision_vm_cdrom is not defined else provision_vm_cdrom }}" customization: "{{ omit if provision_vm_customization is not defined else provision_vm_customization }}" customization_spec: "{{ omit if provision_vm_customization_spec is not defined else provision_vm_customization_spec }}" @@ -45,16 +45,16 @@ force: "{{ omit if provision_vm_force is not defined else provision_vm_force }}" guest_id: "{{ omit if provision_vm_guest_id is not defined else provision_vm_guest_id }}" hardware: "{{ omit if provision_vm_hardware is not defined else provision_vm_hardware }}" - state: "{{ omit if provision_vm_state is not defined else provision_vm_state}}" - state_change_timeout: "{{ omit if provision_vm_state_change_timeout is not defined else provision_vm_state_change_timeout}}" - vapp_properties: "{{ omit if provision_vm_vapp_properties is not defined else provision_vm_vapp_properties}}" - wait_for_customization: "{{ omit if provision_vm_wait_for_customization is not defined else provision_vm_wait_for_customization}}" - wait_for_customization_timeout: "{{ omit if provision_vm_wait_for_customization_timeout is not defined else provision_vm_wait_for_customization_timeout}}" - wait_for_ip_address: "{{ omit if provision_vm_wait_for_ip_address is not defined else provision_vm_wait_for_ip_address}}" - wait_for_ip_address_timeout: "{{ omit if provision_vm_wait_for_ip_address_timeout is not defined else provision_vm_wait_for_ip_address_timeout}}" + state: "{{ omit if provision_vm_state is not defined else provision_vm_state }}" + state_change_timeout: "{{ omit if provision_vm_state_change_timeout is not defined else provision_vm_state_change_timeout }}" + vapp_properties: "{{ omit if provision_vm_vapp_properties is not defined else provision_vm_vapp_properties }}" + wait_for_customization: "{{ omit if provision_vm_wait_for_customization is not defined else provision_vm_wait_for_customization }}" + wait_for_customization_timeout: "{{ omit if provision_vm_wait_for_customization_timeout is not defined else provision_vm_wait_for_customization_timeout }}" + wait_for_ip_address: "{{ omit if provision_vm_wait_for_ip_address is not defined else provision_vm_wait_for_ip_address }}" + wait_for_ip_address_timeout: "{{ omit if provision_vm_wait_for_ip_address_timeout is not defined else provision_vm_wait_for_ip_address_timeout }}" networks: "{{ omit if provision_vm_networks is not defined else provision_vm_networks }}" nvdimm: "{{ omit if provision_vm_nvdimm is not defined else provision_vm_nvdimm }}" - use_instance_uuid: "{{ omit if provision_vm_use_instance_uuid is not defined else provision_vm_use_instance_uuid }}" + use_instance_uuid: "{{ omit if provision_vm_use_instance_uuid is not defined else provision_vm_use_instance_uuid }}" name_match: "{{ omit if provision_vm_name_match is not defined else provision_vm_name_match }}" is_template: false @@ -62,4 +62,4 @@ - name: Print VM information ansible.builtin.debug: - var: my_vm \ No newline at end of file + var: my_vm