From 3667197efb7b18ec842efd504785965911f8ac4b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Jun 2024 18:18:34 +0200 Subject: Adding upstream version 10.0.0+dfsg. Signed-off-by: Daniel Baumann --- .../cisco/intersight/playbooks/count_vms.yml | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 ansible_collections/cisco/intersight/playbooks/count_vms.yml (limited to 'ansible_collections/cisco/intersight/playbooks') diff --git a/ansible_collections/cisco/intersight/playbooks/count_vms.yml b/ansible_collections/cisco/intersight/playbooks/count_vms.yml new file mode 100644 index 000000000..9590a4804 --- /dev/null +++ b/ansible_collections/cisco/intersight/playbooks/count_vms.yml @@ -0,0 +1,26 @@ +--- +- name: Get count + hosts: localhost + connection: local + gather_facts: false + vars: + # Create an anchor for api_info that can be used throughout the file + api_info: &api_info + # if api_key vars are omitted, INTERSIGHT_API_KEY_ID, INTERSIGHT_API_PRIVATE_KEY, + # and INTERSIGHT_API_URI environment variables used for API key data + api_private_key: "{{ api_private_key | default(omit) }}" + api_key_id: "{{ api_key_id | default(omit) }}" + api_uri: "{{ api_uri | default(omit) }}" + validate_certs: "{{ validate_certs | default(omit) }}" + tasks: + # Get a count of the VM hosts + - name: "Get VM Count" + cisco.intersight.intersight_rest_api: + <<: *api_info + resource_path: /virtualization/VirtualMachines + query_params: + $count: true + register: resp + - name: "Print VM count" + ansible.builtin.debug: + msg: "VM count {{ resp.count }}" -- cgit v1.2.3