mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
affaedfca8
Refactoring of the following roles to make use of the new `prepare_vmware_tests` role. - `vmware_resource_pool` - `vmware_resource_pool_facts` - `vmware_target_canonical_facts` - `vmware_vcenter_settings` - `vmware_vcenter_statistics` - `vmware_vm_facts` - `vmware_vm_host_drs_rule` - `vmware_vm_vm_drs_rule` - `vmware_vmkernel` - `vmware_vmkernel_facts` - `vmware_vspan_session` - `vmware_vswitch` - `vmware_vswitch_facts` This patch depends on: https://github.com/ansible/ansible/pull/55719 Original PR: https://github.com/ansible/ansible/pull/54882
86 lines
2.2 KiB
YAML
86 lines
2.2 KiB
YAML
# Test code for the vmware_vcenter_statistics module.
|
|
# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de>
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
- import_role:
|
|
name: prepare_vmware_tests
|
|
|
|
- name: Disable all the statistics
|
|
vmware_vcenter_statistics:
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
interval_past_day:
|
|
enabled: false
|
|
interval_past_week:
|
|
enabled: false
|
|
interval_past_month:
|
|
enabled: false
|
|
interval_past_year:
|
|
enabled: false
|
|
validate_certs: no
|
|
register: statistics_results_check_mode
|
|
|
|
- name: Configure statistics in check mode
|
|
vmware_vcenter_statistics: &stats
|
|
hostname: "{{ vcenter_hostname }}"
|
|
username: "{{ vcenter_username }}"
|
|
password: "{{ vcenter_password }}"
|
|
interval_past_day:
|
|
enabled: true
|
|
interval_minutes: 5
|
|
save_for_days: 3
|
|
level: 2
|
|
interval_past_week:
|
|
enabled: true
|
|
interval_minutes: 30
|
|
save_for_weeks: 1
|
|
level: 2
|
|
interval_past_month:
|
|
enabled: true
|
|
interval_hours: 2
|
|
save_for_months: 1
|
|
level: 1
|
|
interval_past_year:
|
|
enabled: true
|
|
interval_days: 1
|
|
save_for_years: 1
|
|
level: 1
|
|
validate_certs: no
|
|
register: statistics_results_check_mode
|
|
check_mode: yes
|
|
|
|
- debug: var=statistics_results_check_mode
|
|
|
|
- name: ensure statistics were configured
|
|
assert:
|
|
that:
|
|
# Doesn't really work with vcsim. No matter which settings are used; they are always shown as already configured!?
|
|
- statistics_results_check_mode is changed
|
|
when: vcsim is not defined
|
|
|
|
- name: Configure statistics
|
|
vmware_vcenter_statistics:
|
|
<<: *stats
|
|
register: statistics_results
|
|
|
|
- debug: var=statistics_results
|
|
|
|
- name: ensure statistics were configured
|
|
assert:
|
|
that:
|
|
- statistics_results is changed
|
|
when: vcsim is not defined
|
|
|
|
- name: Configure statistics (again)
|
|
vmware_vcenter_statistics:
|
|
<<: *stats
|
|
register: statistics_results
|
|
|
|
- debug: var=statistics_results
|
|
|
|
- name: ensure statistics were configured
|
|
assert:
|
|
that:
|
|
- not (statistics_results is changed)
|
|
when: vcsim is not defined
|