-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Integration][omevv_baseline_profile] - Create, Modify and Delete
- Loading branch information
1 parent
ab23bbc
commit 4c0788c
Showing
11 changed files
with
597 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
tests/integration/targets/omevv_baseline_profile/defaults/main.yaml
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,3 @@ | ||
--- | ||
testcase: '[^_].*' | ||
test_items: [] |
218 changes: 218 additions & 0 deletions
218
tests/integration/targets/omevv_baseline_profile/files/ansible_doc.txt
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,218 @@ | ||
- ' This module allows you to create, modify, or delete an' | ||
- ' OpenManage Enterprise Integration for VMware Center (OMEVV)' | ||
- ' baseline profile.' | ||
- '' | ||
- 'ADDED IN: version 9.9.0 of dellemc.openmanage' | ||
- '' | ||
- 'OPTIONS (= is mandatory):' | ||
- '' | ||
- '- ca_path' | ||
- ' The Privacy Enhanced Mail (PEM) file that contains a CA' | ||
- ' certificate to be used for the validation.' | ||
- ' default: null' | ||
- ' type: path' | ||
- '' | ||
- '- cluster' | ||
- ' List of cluster(s) for baseline profile creation.' | ||
- ' This parameter is required when `state'' is `present'' and while' | ||
- ' creating a new profile.' | ||
- ' default: null' | ||
- ' elements: str' | ||
- ' type: list' | ||
- '' | ||
- '- days' | ||
- ' Required days of a week on when the job must run.' | ||
- ' This is required when `state'' is `present'' and while creating' | ||
- ' a new profile.' | ||
- ' choices: [sunday, monday, tuesday, wednesday, thursday, friday, saturday, | ||
all]' | ||
- ' default: null' | ||
- ' elements: str' | ||
- ' type: list' | ||
- '' | ||
- '- description' | ||
- ' Description of OMEVV baseline profile.' | ||
- ' default: null' | ||
- ' type: str' | ||
- '' | ||
- = hostname | ||
- ' IP address or hostname of the OpenManage Enterprise Modular.' | ||
- ' type: str' | ||
- '' | ||
- '- job_wait' | ||
- ' Whether to wait till completion of the job.' | ||
- ' default: true' | ||
- ' type: bool' | ||
- '' | ||
- '- job_wait_timeout' | ||
- ' The maximum wait time of `job_wait'' in seconds. The job is' | ||
- ' tracked only for this duration.' | ||
- ' This is applicable when `job_wait'' is `true''.' | ||
- ' default: 1200' | ||
- ' type: int' | ||
- '' | ||
- = name | ||
- ' Name of the OMEVV baseline profile.' | ||
- ' This parameter is required for modification operation when' | ||
- ' `state'' is `absent''.' | ||
- ' type: str' | ||
- '' | ||
- '- port' | ||
- ' OpenManage Enterprise HTTPS port.' | ||
- ' default: 443' | ||
- ' type: int' | ||
- '' | ||
- '- repository_profile' | ||
- ' Repository profile for baseline creation.' | ||
- ' This is required when `state'' is `present'' and while creating' | ||
- ' a new profile.' | ||
- ' default: null' | ||
- ' type: str' | ||
- '' | ||
- '- state' | ||
- ' `present'' creates an OMEVV baseline profile or modifies an' | ||
- ' existing profile if the profile with the same name already' | ||
- ' exists.' | ||
- ' `absent'' deletes the OMEVV baseline profile.' | ||
- ' `repository_profile'', `cluster'', `days'' and `time'' is required' | ||
- ' when creating a new baseline profile.' | ||
- ' Either `profile_name'' or `profile_id'' is required when `state''' | ||
- ' is `absent''.' | ||
- ' choices: [present, absent]' | ||
- ' default: present' | ||
- ' type: str' | ||
- '' | ||
- '- time' | ||
- ' Time at when the job must run, and is 24 hours format.' | ||
- ' The format must be HH:MM.' | ||
- ' This is required when `state'' is `present'' and while creating' | ||
- ' a new profile.' | ||
- ' default: null' | ||
- ' type: str' | ||
- '' | ||
- '- timeout' | ||
- ' The socket level timeout in seconds.' | ||
- ' default: 30' | ||
- ' type: int' | ||
- '' | ||
- '- validate_certs' | ||
- ' Whether to check SSL certificate. - If `true'', the SSL' | ||
- ' certificates will be validated. - If `false'', the SSL' | ||
- ' certificates will not be validated.' | ||
- ' default: true' | ||
- ' type: bool' | ||
- '' | ||
- '- vcenter_password' | ||
- ' Password for OpenManage Enterprise Integration for VMware' | ||
- ' vCenter (OMEVV).' | ||
- ' If the password is not provided, then the environment variable' | ||
- ' `OMEVV_VCENTER_PASSWORD'' is used.' | ||
- ' Example: export OMEVV_VCENTER_PASSWORD=password' | ||
- ' default: null' | ||
- ' type: str' | ||
- '' | ||
- '- vcenter_username' | ||
- ' Username for OpenManage Enterprise Integration for VMware' | ||
- ' vCenter (OMEVV).' | ||
- ' If the username is not provided, then the environment variable' | ||
- ' `OMEVV_VCENTER_USERNAME'' is used.' | ||
- ' Example: export OMEVV_VCENTER_USERNAME=username' | ||
- ' default: null' | ||
- ' type: str' | ||
- '' | ||
- '- vcenter_uuid' | ||
- ' Universally Unique Identifier (UUID) of vCenter.' | ||
- ' vCenter UUID details can be retrieved using' | ||
- ' [dellemc.openmanage.omevv_vcenter_info] module.' | ||
- ' If UUID is not provided, then the environment variable' | ||
- ' `OMEVV_VCENTER_UUID'' is used.' | ||
- ' Example: export OMEVV_VCENTER_UUID=uuid' | ||
- ' default: null' | ||
- ' type: str' | ||
- '' | ||
- '' | ||
- 'ATTRIBUTES:' | ||
- '' | ||
- ' check_mode:' | ||
- ' description: Runs task to validate without performing action on the target | ||
machine.' | ||
- ' support: full' | ||
- ' diff_mode:' | ||
- ' description: Runs the task to report the changes that are made or the | ||
changes that' | ||
- ' must be applied.' | ||
- ' support: full' | ||
- '' | ||
- 'NOTES:' | ||
- ' * Run this module from a system that has direct access to' | ||
- ' Dell OpenManage Enterprise.' | ||
- '' | ||
- '' | ||
- 'REQUIREMENTS: python >= 3.9.6' | ||
- '' | ||
- 'AUTHOR: Saksham Nautiyal (@Saksham-Nautiyal)' | ||
- '' | ||
- 'EXAMPLES:' | ||
- '' | ||
- '---' | ||
- '- name: Create a baseline profile for multiple cluster' | ||
- ' dellemc.openmanage.omevv_baseline_profile:' | ||
- ' hostname: "192.168.0.1"' | ||
- ' vcenter_uuid: "xxxxx"' | ||
- ' vcenter_username: "username"' | ||
- ' vcenter_password: "password"' | ||
- ' ca_path: "path/to/ca_file"' | ||
- ' state: "present"' | ||
- ' name: "profile-1"' | ||
- ' repository_profile: "repository-profile"' | ||
- ' cluster:' | ||
- ' - "cluster-1"' | ||
- ' - "cluster-2"' | ||
- ' days:' | ||
- ' - "sunday"' | ||
- ' - "wednesday"' | ||
- ' time: "22:10"' | ||
- '' | ||
- '- name: Modify a baseline profile' | ||
- ' dellemc.openmanage.omevv_baseline_profile:' | ||
- ' hostname: "192.168.0.1"' | ||
- ' vcenter_uuid: "xxxxx"' | ||
- ' vcenter_username: "username"' | ||
- ' vcenter_password: "password"' | ||
- ' ca_path: "path/to/ca_file"' | ||
- ' state: "present"' | ||
- ' name: "profile-1"' | ||
- ' new_name: "profile-newname"' | ||
- ' repository_profile: "repository-profile"' | ||
- ' cluster:' | ||
- ' - "cluster-1"' | ||
- ' - "cluster-2"' | ||
- ' days:' | ||
- ' - "sunday"' | ||
- ' time: "05:00"' | ||
- '' | ||
- '- name: Delete a specific baseline profile' | ||
- ' dellemc.openmanage.omevv_baseline_profile:' | ||
- ' hostname: "192.168.0.1"' | ||
- ' vcenter_uuid: "xxxxx"' | ||
- ' vcenter_username: "username"' | ||
- ' vcenter_password: "password"' | ||
- ' ca_path: "path/to/ca_file"' | ||
- ' state: "absent"' | ||
- ' name: "profile-1"' | ||
- '' | ||
- '' | ||
- 'RETURN VALUES:' | ||
- '- error_info' | ||
- ' Details of the HTTP Error.' | ||
- ' returned: on HTTP error' | ||
- ' sample:' | ||
- ' errorCode: ''18001''' | ||
- ' message: Baseline profile with name Test already exists.' | ||
- ' type: dict' | ||
- '' | ||
- '- msg' | ||
- ' Status of the profile operation.' | ||
- ' returned: always' | ||
- ' sample: Successfully created the OMEVV baseline profile.' | ||
- ' type: str' |
3 changes: 3 additions & 0 deletions
3
tests/integration/targets/omevv_baseline_profile/meta/main.yaml
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,3 @@ | ||
--- | ||
dependencies: | ||
- prepare_omevv_registration |
23 changes: 23 additions & 0 deletions
23
tests/integration/targets/omevv_baseline_profile/tasks/main.yaml
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,23 @@ | ||
--- | ||
- name: Collect all test cases | ||
ansible.builtin.find: | ||
paths: '{{ role_path }}/tests' | ||
patterns: '{{ testcase }}.yaml' | ||
use_regex: true | ||
register: test_cases | ||
delegate_to: localhost | ||
|
||
- name: Set test_items | ||
ansible.builtin.set_fact: | ||
test_items: "{{ test_cases.files | map(attribute='path') | list }}" | ||
|
||
- name: Fail if no test cases are found as per pattern. | ||
ansible.builtin.fail: | ||
msg: "Could not find test cases to run!!!" | ||
when: not test_items|length > 0 | ||
|
||
- name: Run test case | ||
ansible.builtin.include_tasks: '{{ test_case_to_run }}' | ||
with_items: '{{ test_items }}' | ||
loop_control: | ||
loop_var: test_case_to_run |
42 changes: 42 additions & 0 deletions
42
tests/integration/targets/omevv_baseline_profile/tests/_cleanup.yml
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,42 @@ | ||
--- | ||
- block: | ||
- name: Delete baseline profile | ||
dellemc.openmanage.omevv_baseline_profile: | ||
state: absent | ||
name: OMAM_Baseline_Profile | ||
register: delete_baseline_profile | ||
|
||
- name: Verify task status - Delete baseline profile | ||
ansible.builtin.assert: | ||
that: | ||
- delete_baseline_profile.changed | ||
- 'delete_baseline_profile.msg == "Successfully deleted the OMEVV | ||
baseline profile."' | ||
|
||
- name: Delete Repository profile | ||
dellemc.openmanage.omevv_baseline_profile: | ||
state: absent | ||
name: OMAM_Firm_Repo | ||
register: delete_firm_repo_profile | ||
|
||
- name: Verify task status - Delete baseline profile | ||
ansible.builtin.assert: | ||
that: | ||
- delete_firm_repo_profile.changed | ||
- 'delete_firm_repo_profile.msg == "Successfully deleted the OMEVV | ||
firmware repository profile."' | ||
|
||
module_defaults: | ||
dellemc.openmanage.omevv_baseline_profile: | ||
validate_certs: "{{ validate_certs }}" | ||
hostname: "{{ hostname | ansible.utils.ipwrap }}" | ||
vcenter_username: "{{ vcenter_username }}" | ||
vcenter_password: "{{ vcenter_password }}" | ||
vcenter_uuid: "{{ uuid }}" | ||
|
||
dellemc.openmanage.omevv_firmware_repository_profile: | ||
validate_certs: "{{ validate_certs }}" | ||
hostname: "{{ hostname | ansible.utils.ipwrap }}" | ||
vcenter_username: "{{ vcenter_username }}" | ||
vcenter_password: "{{ vcenter_password }}" | ||
vcenter_uuid: "{{ uuid }}" |
26 changes: 26 additions & 0 deletions
26
tests/integration/targets/omevv_baseline_profile/tests/_helper_create.yml
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,26 @@ | ||
--- | ||
- block: | ||
- name: Create firmware repository profile | ||
dellemc.openmanage.omevv_firmware_repository_profile: | ||
name: "OMAM_Firm_Repo" | ||
description: "Firmware repository profile created by OMAM" | ||
state: present | ||
catalog_path: "{{ http_share_dir_path }}/omevv_baseline_profile_catalog.xml" | ||
protocol_type: HTTP | ||
register: firm_repo | ||
|
||
- name: Assertion for creating firmware repository profile - Normal Mode | ||
ansible.builtin.assert: | ||
that: | ||
- firm_repo.changed is true | ||
- firm_repo.msg == "Successfully created the OMEVV firmware repository | ||
profile." | ||
- firm_repo.profile_info.status == "Success" | ||
|
||
module_defaults: | ||
dellemc.openmanage.omevv_firmware_repository_profile: | ||
validate_certs: "{{ validate_certs }}" | ||
hostname: "{{ hostname | ansible.utils.ipwrap }}" | ||
vcenter_username: "{{ vcenter_username }}" | ||
vcenter_password: "{{ vcenter_password }}" | ||
vcenter_uuid: "{{ uuid }}" |
20 changes: 20 additions & 0 deletions
20
tests/integration/targets/omevv_baseline_profile/tests/_verify_baseline.yml
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,20 @@ | ||
# Retrieve baseline information from OMEVV | ||
--- | ||
- block: | ||
- name: Retrieve Baseline information | ||
dellemc.openmanage.omevv_baseline_profile_info: | ||
name: OMAM_Baseline_Profile | ||
register: baseline_info | ||
|
||
- name: Verify task status - Retrieve Baseline information | ||
ansible.builtin.assert: | ||
that: | ||
- baseline_info.baseline_profile_info == normal_result_baseline.profile_info | ||
|
||
module_defaults: | ||
dellemc.openmanage.omevv_baseline_profile_info: | ||
validate_certs: "{{ validate_certs }}" | ||
hostname: "{{ hostname | ansible.utils.ipwrap }}" | ||
vcenter_username: "{{ vcenter_username }}" | ||
vcenter_password: "{{ vcenter_password }}" | ||
vcenter_uuid: "{{ uuid }}" |
22 changes: 22 additions & 0 deletions
22
tests/integration/targets/omevv_baseline_profile/tests/ansible_doc.yaml
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,22 @@ | ||
# Dell OpenManage Ansible modules | ||
# Copyright (C) 2024 Dell Inc. or its subsidiaries. All Rights Reserved. | ||
|
||
# GNU General Public License v3.0+ (see COPYING or | ||
# https://www.gnu.org/licenses/gpl-3.0.txt) | ||
--- | ||
- block: | ||
- name: ansible-doc | ||
command: ansible-doc dellemc.openmanage.omevv_baseline_profile | ||
register: ansible_doc_hash | ||
|
||
- name: Get ansible-doc output | ||
local_action: copy content={{ansible_doc_hash.stdout_lines[2:] | | ||
to_nice_yaml }} dest={{ role_path }}/files/ansible_doc.txt | ||
register: ansible_doc | ||
check_mode: true | ||
diff: true | ||
|
||
- name: Verify if doc changed | ||
ansible.builtin.assert: | ||
that: not ansible_doc.changed | ||
run_once: true |
Oops, something went wrong.