summaryrefslogtreecommitdiffstats
path: root/ansible_collections/cisco/intersight
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/cisco/intersight')
-rw-r--r--ansible_collections/cisco/intersight/CHANGELOG.md3
-rw-r--r--ansible_collections/cisco/intersight/FILES.json11
-rw-r--r--ansible_collections/cisco/intersight/MANIFEST.json4
-rw-r--r--ansible_collections/cisco/intersight/playbooks/count_vms.yml26
-rw-r--r--ansible_collections/cisco/intersight/plugins/module_utils/intersight.py1
5 files changed, 41 insertions, 4 deletions
diff --git a/ansible_collections/cisco/intersight/CHANGELOG.md b/ansible_collections/cisco/intersight/CHANGELOG.md
index 1ed1a5e3e..fac62949e 100644
--- a/ansible_collections/cisco/intersight/CHANGELOG.md
+++ b/ansible_collections/cisco/intersight/CHANGELOG.md
@@ -1,5 +1,8 @@
# cisco.intersight Ansible Collection Changelog
+## Version 2.0.9
+- Fix issue #114 to support $count query param
+
## Version 2.0.8
- Fix issue #111 to allow User Policy updates
diff --git a/ansible_collections/cisco/intersight/FILES.json b/ansible_collections/cisco/intersight/FILES.json
index 95315ee60..fff54d97f 100644
--- a/ansible_collections/cisco/intersight/FILES.json
+++ b/ansible_collections/cisco/intersight/FILES.json
@@ -46,7 +46,7 @@
"name": "CHANGELOG.md",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "184c0ed03fe6bbd200481b356aab0a3e8c92fbb08bcf3ca6057c53fac6e65e1d",
+ "chksum_sha256": "a5b35131740307d42fbd05f3ae58102a6efc3fadbc2fa484e51cb46f92e9faeb",
"format": 1
},
{
@@ -88,7 +88,7 @@
"name": "plugins/module_utils/intersight.py",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "4b3f573930d8818604518a9f0131e4f12dbea0509b1158f4fd8004e0967a3a3d",
+ "chksum_sha256": "a5608cbf9e6abd118ac846b95204afe39ff4aad15c34c2f324cdb78e6b87d1c6",
"format": 1
},
{
@@ -330,6 +330,13 @@
"format": 1
},
{
+ "name": "playbooks/count_vms.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6d4c73d070fa70eead9a41b3f4062398586d6ddca57a077a208d827baba110ae",
+ "format": 1
+ },
+ {
"name": "playbooks/roles",
"ftype": "dir",
"chksum_type": null,
diff --git a/ansible_collections/cisco/intersight/MANIFEST.json b/ansible_collections/cisco/intersight/MANIFEST.json
index 990405175..59a47d8be 100644
--- a/ansible_collections/cisco/intersight/MANIFEST.json
+++ b/ansible_collections/cisco/intersight/MANIFEST.json
@@ -2,7 +2,7 @@
"collection_info": {
"namespace": "cisco",
"name": "intersight",
- "version": "2.0.8",
+ "version": "2.0.9",
"authors": [
"David Soper (@dsoper2)"
],
@@ -27,7 +27,7 @@
"name": "FILES.json",
"ftype": "file",
"chksum_type": "sha256",
- "chksum_sha256": "7958d8bc5047610831777f3a56171c17f505aff4bd24acfe861039c60da2c771",
+ "chksum_sha256": "c34815de4b4e930a5a0d62ab855cb1cbfeb27876d40417b91496c934042a9222",
"format": 1
},
"format": 1
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 }}"
diff --git a/ansible_collections/cisco/intersight/plugins/module_utils/intersight.py b/ansible_collections/cisco/intersight/plugins/module_utils/intersight.py
index 143cd7d25..552afebb7 100644
--- a/ansible_collections/cisco/intersight/plugins/module_utils/intersight.py
+++ b/ansible_collections/cisco/intersight/plugins/module_utils/intersight.py
@@ -360,6 +360,7 @@ class IntersightModule():
else:
# return the 1st list element
self.result['api_response'] = response['Results'][0]
+ self.result['count'] = response.get('Count')
self.result['trace_id'] = response.get('trace_id')
def configure_resource(self, moid, resource_path, body, query_params, update_method=''):