-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] Move adding KMS server task at the beginning of deploy_vm.y…
…ml (#458) Signed-off-by: Diane Wang <[email protected]>
- Loading branch information
Showing
5 changed files
with
116 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
# The prerequsite of adding virtual TPM device to VM is key provider | ||
# configured on vCenter server. | ||
# When 'key_provider_type' parameter is set, add a new key provider with | ||
# specified type firstly, now only support Standard key provider configuration. | ||
# | ||
# Parameters: | ||
# key_provider_type: valid values are 'standard', 'native', now only 'standard' | ||
# is supported. | ||
# vc_cert_path: the file path on local machine for saving vCenter certificate. | ||
# | ||
- name: "Set fact of default key provider type" | ||
ansible.builtin.set_fact: | ||
key_provider_type: 'standard' | ||
when: key_provider_type is undefined or not key_provider_type | ||
|
||
- name: "Check configured key provider type" | ||
ansible.builtin.assert: | ||
that: | ||
- key_provider_type | lower == 'standard' | ||
fail_msg: "Now the valid value of parameter 'key_provider_type' is 'standard', while configured value is '{{ key_provider_type }}'." | ||
|
||
- name: "Check required parameter" | ||
ansible.builtin.assert: | ||
that: | ||
- vc_cert_path is defined | ||
- vc_cert_path | ||
fail_msg: "Parameter 'vc_cert_path' is required to be set to a valid path in local machine." | ||
|
||
- name: "Set fact of new key provider name" | ||
ansible.builtin.set_fact: | ||
new_kp_name: "{{ key_provider_type | lower }}{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}" | ||
|
||
- name: "Add key provider on vCenter server" | ||
include_tasks: vcenter_add_standard_kp.yml | ||
vars: | ||
standard_kp_name: "{{ new_kp_name }}" | ||
vc_cert_download_path: "{{ vc_cert_path }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,21 @@ | ||
# Copyright 2022-2023 VMware, Inc. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
--- | ||
# The prerequsite of adding virtual TPM device to VM is | ||
# key provider configured on vCenter. | ||
# Add new vTPM device to VM and check device exists. | ||
# | ||
# When 'key_provider_type' parameter is set, add a new key | ||
# provider with specified type firstly, now only support | ||
# Standard key provider configuration. | ||
# | ||
- block: | ||
- name: Check key provider type value | ||
ansible.builtin.assert: | ||
that: | ||
- key_provider_type | lower == 'standard' | ||
fail_msg: "Parameter 'key_provider_type' valid value is 'standard', but configured '{{ key_provider_type }}'." | ||
|
||
- name: Set fact of new key provider name | ||
ansible.builtin.set_fact: | ||
new_kp_name: "{{ key_provider_type | lower }}{{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}" | ||
|
||
- include_tasks: vcenter_add_standard_kp.yml | ||
vars: | ||
standard_kp_name: "{{ new_kp_name }}" | ||
vc_cert_download_path: "{{ vc_cert_path }}" | ||
when: key_provider_type | lower == 'standard' | ||
when: | ||
- key_provider_type is defined | ||
- key_provider_type | ||
|
||
# When key provider type is not configured, means use the existing configured one. | ||
# Will add get existing configured key provider info after new community.vmware module added | ||
# TBD: add a new task to check key provider status when key_provider_type is not defined. | ||
|
||
- include_tasks: vm_add_remove_vtpm.yml | ||
- name: "Add new vTPM device to VM" | ||
include_tasks: vm_add_remove_vtpm.yml | ||
vars: | ||
vtpm_operation: 'present' | ||
- include_tasks: vm_get_device_with_label.yml | ||
|
||
- name: "Get vTPM device on VM" | ||
include_tasks: vm_get_device_with_label.yml | ||
vars: | ||
device_label: 'Virtual TPM' | ||
- name: Check Virtual TPM device on VM | ||
|
||
- name: "Check vTPM device exists on VM" | ||
ansible.builtin.assert: | ||
that: | ||
- device_info_with_label is defined | ||
- device_info_with_label != "" | ||
fail_msg: "Can not get Virtual TPM device on VM." | ||
fail_msg: "Not get vTPM device on VM after adding vTPM device." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters