Skip to content

Commit

Permalink
added work through vCenter Server for ansible-collections#1799 (ansib…
Browse files Browse the repository at this point in the history
…le-collections#1832)

added work through vCenter Server for ansible-collections#1799

SUMMARY
Fixes ansible-collections#1799
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
vmware_host_snmp

Reviewed-by: Mario Lenz <m@riolenz.de>
  • Loading branch information
ihumster authored and mariolenz committed Oct 13, 2023
1 parent 1d6a5a0 commit f5802fb
Show file tree
Hide file tree
Showing 5 changed files with 504 additions and 284 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- community.vmware.vmware_host_snmp module now can configure SNMP agent on set of hosts (list in esxi_hostname parameter or as cluster in cluster_name parameter). The ability to configure the host directly remains
61 changes: 50 additions & 11 deletions docs/community.vmware.vmware_host_snmp_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ Parameters
<th>Choices/<font color="blue">Defaults</font></th>
<th width="100%">Comments</th>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>cluster_name</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
<div style="font-style: italic; font-size: small; color: darkgreen">added in 3.10.0</div>
</td>
<td>
</td>
<td>
<div>Name of cluster.</div>
<div>All host system from given cluster used to manage SNMP agent.</div>
<div>Required parameter, if <code>esxi_hostname</code> is not set.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand All @@ -49,6 +67,24 @@ Parameters
<div>List of SNMP community strings.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>esxi_hostname</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
/ <span style="color: purple">elements=string</span>
</div>
<div style="font-style: italic; font-size: small; color: darkgreen">added in 3.10.0</div>
</td>
<td>
</td>
<td>
<div>List of ESXi hostname to manage SNMP agent.</div>
<div>Required parameter, if <code>cluster_name</code> is not set.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand Down Expand Up @@ -356,7 +392,7 @@ Examples

.. code-block:: yaml
- name: Enable and configure SNMP community
- name: Enable and configure SNMP community on standalone ESXi host
community.vmware.vmware_host_snmp:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
Expand All @@ -365,11 +401,12 @@ Examples
state: enabled
delegate_to: localhost
- name: Configure SNMP traps and filters
- name: Configure SNMP traps and filters on cluster
community.vmware.vmware_host_snmp:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
cluster_name: '{{ cluster_name }}'
community: [ test ]
trap_targets:
- hostname: 192.168.1.100
Expand All @@ -384,17 +421,18 @@ Examples
state: enabled
delegate_to: localhost
- name: Enable and configure SNMP system contact and location
- name: Enable and configure SNMP system contact and location on simple ESXi host in vCenter
community.vmware.vmware_host_snmp:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
password: '{{ esxi_password }}'
hostname: '{{ vcenter_hostname }}'
username: '{{ vcenter_username }}'
password: '{{ vcenter_password }}'
esxi_hostname: '{{ esxi_hostname }}'
sys_contact: "admin@testemail.com"
sys_location: "Austin, USA"
state: enabled
delegate_to: localhost
- name: Disable SNMP
- name: Disable SNMP on standalone ESXi host
community.vmware.vmware_host_snmp:
hostname: '{{ esxi_hostname }}'
username: '{{ esxi_username }}'
Expand Down Expand Up @@ -430,7 +468,7 @@ Common return values are documented `here <https://docs.ansible.com/ansible/late
<div>metadata about host system&#x27;s SNMP configuration</div>
<br/>
<div style="font-size: smaller"><b>Sample:</b></div>
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{&#x27;esxi01&#x27;: {&#x27;changed&#x27;: False, &#x27;community&#x27;: [&#x27;test&#x27;], &#x27;hw_source&#x27;: &#x27;indications&#x27;, &#x27;msg&#x27;: &#x27;SNMP already configured properly&#x27;, &#x27;port&#x27;: 161, &#x27;state&#x27;: &#x27;enabled&#x27;, &#x27;trap_targets&#x27;: []}}</div>
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">{&#x27;changed&#x27;: True, &#x27;esx01.example.local&#x27;: {&#x27;changed&#x27;: True, &#x27;community&#x27;: [&#x27;test&#x27;], &#x27;community_previous&#x27;: [], &#x27;hw_source&#x27;: &#x27;indications&#x27;, &#x27;log_level&#x27;: &#x27;info&#x27;, &#x27;log_level_previous&#x27;: &#x27;warning&#x27;, &#x27;msg&#x27;: &#x27;SNMP state, community list, log level, sys contact, and sys location changed&#x27;, &#x27;port&#x27;: 161, &#x27;state&#x27;: &#x27;enabled&#x27;, &#x27;state_previous&#x27;: &#x27;disabled&#x27;, &#x27;sys_contact_previous&#x27;: &#x27;&#x27;, &#x27;sys_location_previous&#x27;: &#x27;&#x27;, &#x27;trap_filter&#x27;: None, &#x27;trap_targets&#x27;: []}, &#x27;failed&#x27;: False}</div>
</td>
</tr>
</table>
Expand All @@ -445,3 +483,4 @@ Authors
~~~~~~~

- Christian Kotte (@ckotte)
- Alexander Nikitin (@ihumster)
Loading

0 comments on commit f5802fb

Please sign in to comment.