2018-12-05 11:16:42 +01:00
|
|
|
# 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)
|
|
|
|
|
2019-05-03 05:19:02 +02:00
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
2018-12-05 11:16:42 +01:00
|
|
|
|
2019-05-03 05:19:02 +02:00
|
|
|
- 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
|
2018-12-05 11:16:42 +01:00
|
|
|
|
|
|
|
- name: Configure statistics in check mode
|
2019-05-03 05:19:02 +02:00
|
|
|
vmware_vcenter_statistics: &stats
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2018-12-05 11:16:42 +01:00
|
|
|
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
|
|
|
|
|
2019-05-03 05:19:02 +02:00
|
|
|
- debug: var=statistics_results_check_mode
|
2018-12-05 11:16:42 +01:00
|
|
|
|
|
|
|
- name: ensure statistics were configured
|
|
|
|
assert:
|
|
|
|
that:
|
2019-05-03 05:19:02 +02:00
|
|
|
# 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
|
2018-12-05 11:16:42 +01:00
|
|
|
|
|
|
|
- name: Configure statistics
|
|
|
|
vmware_vcenter_statistics:
|
2019-05-03 05:19:02 +02:00
|
|
|
<<: *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
|
2018-12-05 11:16:42 +01:00
|
|
|
register: statistics_results
|
|
|
|
|
2019-05-03 05:19:02 +02:00
|
|
|
- debug: var=statistics_results
|
2018-12-05 11:16:42 +01:00
|
|
|
|
|
|
|
- name: ensure statistics were configured
|
|
|
|
assert:
|
|
|
|
that:
|
2019-05-03 05:19:02 +02:00
|
|
|
- not (statistics_results is changed)
|
|
|
|
when: vcsim is not defined
|
2019-08-25 20:35:36 +02:00
|
|
|
|
|
|
|
- name: Configure statistics intervall to level 2 for later check
|
|
|
|
vmware_vcenter_statistics:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
interval_past_day:
|
|
|
|
enabled: true
|
|
|
|
level: 2
|
|
|
|
interval_past_week:
|
|
|
|
enabled: true
|
|
|
|
level: 2
|
|
|
|
interval_past_month:
|
|
|
|
enabled: true
|
|
|
|
level: 2
|
|
|
|
interval_past_year:
|
|
|
|
enabled: true
|
|
|
|
level: 2
|
|
|
|
validate_certs: no
|
|
|
|
when: vcsim is not defined
|
|
|
|
|
|
|
|
- name: Increase daily and weekly while decrease monthly and yearly
|
|
|
|
vmware_vcenter_statistics:
|
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
|
|
|
interval_past_day:
|
|
|
|
enabled: true
|
|
|
|
level: 3
|
|
|
|
interval_past_week:
|
|
|
|
enabled: true
|
|
|
|
level: 3
|
|
|
|
interval_past_month:
|
|
|
|
enabled: true
|
|
|
|
level: 1
|
|
|
|
interval_past_year:
|
|
|
|
enabled: true
|
|
|
|
level: 1
|
|
|
|
validate_certs: no
|
|
|
|
register: statistics_results_mixed_increase_decrease
|
|
|
|
when: vcsim is not defined
|
|
|
|
|
|
|
|
- name: Ensure statistics were configured
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- statistics_results_mixed_increase_decrease is changed
|
|
|
|
when: vcsim is not defined
|