Skip to content

Commit

Permalink
Adding the targets for ansible-test
Browse files Browse the repository at this point in the history
Signed-off-by: Danielle Barda <dbarda@redhat.com>
  • Loading branch information
bardielle committed Feb 11, 2024
1 parent f9e5bba commit 13571bb
Show file tree
Hide file tree
Showing 17 changed files with 2,037 additions and 39 deletions.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
RELEASE?=0.0.2

lint:
ansible-lint

clean:
rm -rf *tar.gz
# build:
# ansible-galaxy collection build
#
# publish:
# ansible-galaxy collection publish machacekondra-openshift_install-$(RELEASE).tar.gz --token=$(GALAXY_TOKEN)

integration:
ansible-test sanity -v --color --coverage --junit --docker

21 changes: 11 additions & 10 deletions plugins/modules/vmware_cluster.py → plugins/modules/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

# the target test "cluster" covering the testing for that module

from __future__ import absolute_import, division, print_function
__metaclass__ = type


DOCUMENTATION = r'''
---
module: vmware_cluster
module: cluster
short_description: Manage VMware vSphere clusters
description:
- Adds or removes VMware vSphere clusters.
Expand Down Expand Up @@ -40,17 +42,16 @@
default: present
type: str
seealso:
- module: community.vmware.vmware_cluster_drs
- module: community.vmware.vmware_cluster_ha
- module: community.vmware.vmware_cluster_vsan
extends_documentation_fragment:
- community.vmware.vmware.documentation
- module: vmware.vmware.vmware_cluster_drs
- module: vmware.vmware.vmware_cluster_ha
- module: vmware.vmware.vmware_cluster_vsan
'''

EXAMPLES = r'''
- name: Create Cluster
community.vmware.vmware_cluster:
vmware.vmware.cluster:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -59,7 +60,7 @@
delegate_to: localhost
- name: Delete Cluster
community.vmware.vmware_cluster:
vmware.vmware.cluster:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
Expand All @@ -78,10 +79,10 @@
pass

from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.vmware.plugins.module_utils.vmware import (
from ansible_collections.vmware.vmware.plugins.module_utils.vmware import (
vmware_argument_spec,
PyVmomi,
find_datacenter_by_name,
vmware_argument_spec,
wait_for_task)
from ansible.module_utils._text import to_native

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

DOCUMENTATION = r'''
---
module: vmware_cluster_drs
module: cluster_drs
short_description: Manage Distributed Resource Scheduler (DRS) on VMware vSphere clusters
description:
- Manages DRS on VMware vSphere clusters.
Expand Down Expand Up @@ -74,12 +74,12 @@
type: bool
default: false
extends_documentation_fragment:
- community.vmware.vmware.documentation
- vmware.vmware.vmware.documentation
'''

EXAMPLES = r'''
- name: Enable DRS
community.vmware.vmware_cluster_drs:
vmware.vmware.cluster_drs:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -88,7 +88,7 @@
enable: true
delegate_to: localhost
- name: Enable DRS and distribute a more even number of virtual machines across hosts for availability
community.vmware.vmware_cluster_drs:
vmware.vmware.cluster_drs:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -99,7 +99,7 @@
'TryBalanceVmsPerHost': '1'
delegate_to: localhost
- name: Enable DRS and set default VM behavior to partially automated
community.vmware.vmware_cluster_drs:
vmware.vmware.cluster_drs:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
Expand All @@ -119,14 +119,14 @@
pass

from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.vmware.plugins.module_utils.vmware import (
from ansible_collections.vmware.vmware.plugins.module_utils.vmware import (
vmware_argument_spec,
PyVmomi,
TaskError,
find_datacenter_by_name,
vmware_argument_spec,
wait_for_task,
TaskError,
option_diff,
)
wait_for_task)

from ansible.module_utils._text import to_native


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

DOCUMENTATION = r'''
---
module: vmware_cluster_ha
module: cluster_ha
short_description: Manage High Availability (HA) on VMware vSphere clusters
description:
- Manages HA configuration on VMware vSphere clusters.
Expand Down Expand Up @@ -198,13 +198,13 @@
default: 'warning'
choices: [ 'disabled', 'warning', 'restartAggressive' ]
extends_documentation_fragment:
- community.vmware.vmware.documentation
- vmware.vmware.vmware.documentation
'''

EXAMPLES = r'''
- name: Enable HA without admission control
community.vmware.vmware_cluster_ha:
vmware.vmware.cluster_ha:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -214,7 +214,7 @@
delegate_to: localhost
- name: Enable HA and VM monitoring without admission control
community.vmware.vmware_cluster_ha:
vmware.vmware.cluster_ha:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
Expand All @@ -225,7 +225,7 @@
delegate_to: localhost
- name: Enable HA with admission control reserving 50% of resources for HA
community.vmware.vmware_cluster_ha:
vmware.vmware.cluster_ha:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -249,11 +249,11 @@
pass

from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.vmware.plugins.module_utils.vmware import (
from ansible_collections.vmware.vmware.plugins.module_utils.vmware import (
vmware_argument_spec,
PyVmomi,
TaskError,
find_datacenter_by_name,
vmware_argument_spec,
wait_for_task,
option_diff,
)
Expand Down
16 changes: 8 additions & 8 deletions plugins/modules/vmware_host.py → plugins/modules/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

DOCUMENTATION = r'''
---
module: vmware_host
module: host
short_description: Add, remove, or move an ESXi host to, from, or within vCenter
description:
- This module can be used to add, reconnect, or remove an ESXi host to or from vCenter.
Expand Down Expand Up @@ -117,13 +117,13 @@
type: bool
default: true
extends_documentation_fragment:
- community.vmware.vmware.documentation
- vmware.vmware.vmware.documentation
'''

EXAMPLES = r'''
- name: Add ESXi Host to vCenter
community.vmware.vmware_host:
vmware.vmware.host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -136,7 +136,7 @@
delegate_to: localhost
- name: Add ESXi Host to vCenter under a specific folder
community.vmware.vmware_host:
vmware.vmware.host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -150,7 +150,7 @@
delegate_to: localhost
- name: Reconnect ESXi Host (with username/password set)
community.vmware.vmware_host:
vmware.vmware.host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -163,7 +163,7 @@
delegate_to: localhost
- name: Reconnect ESXi Host (with default username/password)
community.vmware.vmware_host:
vmware.vmware.host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand All @@ -174,7 +174,7 @@
delegate_to: localhost
- name: Add ESXi Host with SSL Thumbprint to vCenter
community.vmware.vmware_host:
vmware.vmware.host:
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
Expand Down Expand Up @@ -203,7 +203,7 @@

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
from ansible_collections.community.vmware.plugins.module_utils.vmware import (
from ansible_collections.vmware.vmware.plugins.module_utils.vmware import (
PyVmomi, TaskError, vmware_argument_spec,
wait_for_task, find_host_by_cluster_datacenter, find_hostsystem_by_name
)
Expand Down
Loading

0 comments on commit 13571bb

Please sign in to comment.