mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-22 12:03:58 -07:00
vcenter_license: New module to manage vCenter licenses (#25143)
This module supports check-mode and diff output. It also includes basic integration tests. This PR fixes #24971
This commit is contained in:
parent
71163d4d61
commit
3a86579b69
4 changed files with 287 additions and 0 deletions
2
test/integration/targets/vcenter_license/aliases
Normal file
2
test/integration/targets/vcenter_license/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
posix/ci/cloud/vcenter
|
||||
cloud/vcenter
|
76
test/integration/targets/vcenter_license/tasks/main.yml
Normal file
76
test/integration/targets/vcenter_license/tasks/main.yml
Normal file
|
@ -0,0 +1,76 @@
|
|||
# Test code for the vcenter license module.
|
||||
# (c) 2017, Dag Wieers <dag@wieers.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Make sure pyvmomi is installed
|
||||
pip:
|
||||
name: pyvmomi
|
||||
state: latest
|
||||
|
||||
- name: Store the vCenter container IP
|
||||
set_fact:
|
||||
vcenter_host: "{{ lookup('env', 'vcenter_host') }}"
|
||||
|
||||
- debug:
|
||||
var: vcenter_host
|
||||
|
||||
- name: Wait for vcsim controller to come online {{ vcenter_host }}
|
||||
wait_for:
|
||||
host: "{{ vcenter_host }}"
|
||||
port: 5000
|
||||
state: started
|
||||
|
||||
- name: Kill vcsim
|
||||
uri:
|
||||
url: http://{{ vcenter_host }}:5000/killall
|
||||
|
||||
- name: Start vcsim
|
||||
uri:
|
||||
url: http://{{ vcenter_host }}:5000/spawn?cluster=2
|
||||
register: vcsim_instance
|
||||
|
||||
- debug:
|
||||
var: vcsim_instance
|
||||
|
||||
# FIXME: ServerFaultCode: LicenseManager:LicenseManager does not implement: AddLicense
|
||||
#- name: Add a vCenter evaluation license
|
||||
# vcenter_license:
|
||||
# hostname: '{{ vcenter_host }}'
|
||||
# username: '{{ vcsim_instance["json"]["username"] }}'
|
||||
# password: '{{ vcsim_instance["json"]["password"] }}'
|
||||
# validate_certs: no
|
||||
# license: 00000-00000-00000-00000-00000
|
||||
# state: present
|
||||
|
||||
#- name: Remove an (unused) vCenter evaluation license
|
||||
# vcenter_license:
|
||||
# hostname: '{{ vcenter_host }}'
|
||||
# username: '{{ vcsim_instance["json"]["username"] }}'
|
||||
# password: '{{ vcsim_instance["json"]["password"] }}'
|
||||
# validate_certs: no
|
||||
# license: 00000-00000-00000-00000-00000
|
||||
# state: absent
|
||||
|
||||
#- name: Add an invalid vCenter license
|
||||
# vcenter_license:
|
||||
# hostname: '{{ vcenter_host }}'
|
||||
# username: '{{ vcsim_instance["json"]["username"] }}'
|
||||
# password: '{{ vcsim_instance["json"]["password"] }}'
|
||||
# validate_certs: no
|
||||
# license: 00000-00000-00000-00000-00001
|
||||
# state: present
|
||||
# ignore_errors: yes
|
Loading…
Add table
Add a link
Reference in a new issue