mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
9a561b53fa
* Disable warnings on validate_certs=False * Required requests version * Add testcase for inventory plugin * Include review comments from mattclay * remove pyvmomi installation * remove config file at exit * Add cache in vmware_inventory inventory plugin * shertel review comments * Rename vmware_inventory to vmware_vm_inventory * bcoca's review comments * Export username and password for failing testcase Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
37 lines
1.1 KiB
Bash
Executable file
37 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
[[ -n "$DEBUG" || -n "$ANSIBLE_DEBUG" ]] && set -x
|
|
|
|
set -euo pipefail
|
|
|
|
export ANSIBLE_CONFIG=ansible.cfg
|
|
export vcenter_host="${vcenter_host:-0.0.0.0}"
|
|
export VMWARE_SERVER="${vcenter_host}"
|
|
export VMWARE_USERNAME="${VMWARE_USERNAME:-user}"
|
|
export VMWARE_PASSWORD="${VMWARE_PASSWORD:-pass}"
|
|
VMWARE_CONFIG=test-config.vmware.yaml
|
|
|
|
cat > "$VMWARE_CONFIG" <<VMWARE_YAML
|
|
plugin: vmware_vm_inventory
|
|
strict: False
|
|
validate_certs: False
|
|
with_tags: False
|
|
VMWARE_YAML
|
|
|
|
trap 'rm -f "${VMWARE_CONFIG}"' INT TERM EXIT
|
|
|
|
echo "DEBUG: Using ${vcenter_host} with username ${VMWARE_USERNAME} and password ${VMWARE_PASSWORD}"
|
|
|
|
echo "Kill all previous instances"
|
|
curl "http://${vcenter_host}:5000/killall" > /dev/null 2>&1
|
|
|
|
echo "Start new VCSIM server"
|
|
curl "http://${vcenter_host}:5000/spawn?datacenter=1&cluster=1&folder=0" > /dev/null 2>&1
|
|
|
|
echo "Debugging new instances"
|
|
curl "http://${vcenter_host}:5000/govc_find"
|
|
|
|
# Get inventory
|
|
ansible-inventory -i ${VMWARE_CONFIG} --list
|
|
# Test playbook with given inventory
|
|
ansible-playbook -i ${VMWARE_CONFIG} test_vmware_vm_inventory.yml --connection=local "$@"
|