Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <qiz@vmware.com>
  • Loading branch information
keirazhang committed May 30, 2023
1 parent eb5f938 commit cab1590
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions common/vcenter_get_domain_user_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# vcenter_domain_name: The vCenter Server user domain name. Default is same with vcenter_username domain.
# vcenter_domain_user_name: The domain user name.
#
- name: "Assert vcenter_domain_user_name is set"
- name: "Check parameter 'vcenter_domain_user_name' is set"
ansible.builtin.assert:
that:
- vcenter_is_defined is defined
Expand Down Expand Up @@ -39,7 +39,7 @@
exact_match: true
register: get_domain_user_result

- name: "Set fact of vCenter domain user existing or not"
- name: "Set fact of vCenter Server domain user"
ansible.builtin.set_fact:
vcenter_domain_user_info: "{{ get_domain_user_result.domain_user_groups[0] }}"
when:
Expand Down
26 changes: 18 additions & 8 deletions common/vcenter_manage_domain_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
---
# Add or delete a domain user on vCenter Server
# Parameters:
# vcenter_domain_name: The vCenter Server user domain name. Default is vcenter_username domain.
# vcenter_domain_user_name: The domain user name.
# vcenter_domain_user_first_name: The first name of domain user. Default is same as user name.
# vcenter_domain_user_last_name: The last name of domain user. Default is same as domain name.
# vcenter_domain_user_password: The domain user password.
# vcenter_domain_user_group: The user group which domain user belongs to. Default is empty.
# vcenter_domain_user_op: The operation of managing domain user: add or delete.
# vcenter_domain_name(optional): The vCenter Server user domain name.
# Default is vcenter_username domain.
# vcenter_domain_user_first_name(optional): The first name of domain user.
# Default is same as user name.
# vcenter_domain_user_last_name(optional): The last name of domain user.
# Default is same as domain name.
# vcenter_domain_user_group(optional): The user group which domain user belongs to.
# Default is empty.
#
# vcenter_is_defined is defined in common/set_vmware_module_hostname.yml
# groups['vcenter'] is defined in common/add_vsphere_hosts_in_inventory.yml
# both of them are set at env_setup
- name: "Check vCenter Server is defined and added into memory inventory"
ansible.builtin.assert:
that:
Expand All @@ -24,17 +31,20 @@
and vCenter Server hostname in memory inventory is
{{ groups['vcenter'] is defined and vcenter_hostname in groups['vcenter'] }}.
- name: "Check vcenter_domain_user_name and vcenter_domain_user_op is set"
- name: "Check vcenter_domain_user_name, vcenter_domain_user_password and vcenter_domain_user_op are set"
ansible.builtin.assert:
that:
- vcenter_domain_user_name is defined
- vcenter_domain_user_name
- vcenter_domain_user_password is defined
- vcenter_domain_user_password
- vcenter_domain_user_op is defined
- vcenter_domain_user_op in ['add', 'delete']
fail_msg: >-
Parameter 'vcenter_domain_user_name' or 'vcenter_domain_user_op' is incorrect
for managing domain user.
Parameter 'vcenter_domain_user_name','vcenter_domain_user_password' and 'vcenter_domain_user_op'
must be set correclty for managing domain user.
Current vcenter_domain_user_name is {{ vcenter_domain_user_name | default('undefined') }},
vcenter_domain_user_password is {{ vcenter_domain_user_password | default('undefined') }},
and vcenter_domain_user_op is {{ vcenter_domain_user_op | default('undefined') }}.
- name: "Set default user domain of vCenter Server"
Expand Down Expand Up @@ -64,7 +74,7 @@
when: vcenter_domain_user_op == "delete"

- name: "{{ vcenter_domain_user_op | capitalize }} domain user '{{ vcenter_domain_user_name }}@{{ vcenter_domain_name }}'"
ansible.builtin.command: "{{ manage_domain_user_cmd }}"
ansible.builtin.command: "{{ manage_domain_user_cmd }}"
ignore_errors: true
delegate_to: "{{ vcenter_hostname }}"
register: manage_domain_user_result
Expand Down
2 changes: 1 addition & 1 deletion windows/utils/win_collect_vgauth_logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
include_tasks: win_get_file.yml
vars:
win_get_file_src_path: "{{ vgauth_log_file_src }}"
win_get_file_dst_path: "{{ current_test_log_folder }}/"
win_get_file_dst_path: "{{ current_test_log_folder }}"

- name: "Start VGAuthService after getting its log file"
include_tasks: win_execute_cmd.yml
Expand Down
6 changes: 3 additions & 3 deletions windows/utils/win_enable_vgauth_log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
vars:
win_check_file_exist_file: "{{ vgauth_config_file }}"

- include_tasks: win_write_to_file.yml
- name: "Add VGAuthService config file with logging options"
include_tasks: win_write_to_file.yml
vars:
write_file_path: "{{ vgauth_config_file }}"
write_file_content: |
Expand All @@ -36,15 +37,14 @@
path: "{{ vgauth_config_file }}"
regexp: "^(# *)?loglevel.*"
line: "loglevel=verbose"
state: present
delegate_to: "{{ vm_guest_ip }}"
when: win_check_file_exist_result

- name: "Save VGAuthService config file to local log directory"
include_tasks: win_get_file.yml
vars:
win_get_file_src_path: "{{ vgauth_config_file }}"
win_get_file_dst_path: "{{ current_test_log_folder }}/"
win_get_file_dst_path: "{{ current_test_log_folder }}"

- name: "Retart guest OS to make config take effect"
include_tasks: win_shutdown_restart.yml
Expand Down

0 comments on commit cab1590

Please sign in to comment.