mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
* win_snmp: Initial commit * win_snmp: Better handling of lists * win_snmp: Documentation fixes * win_snmp: Updated documentation to match parameters * win_snmp: Added integration tests * win_snmp: Fixed typo in test * win_snmp: Adjusted parameter checks to match documentation * win_snmp: Updated option descriptions to be full sentences * win_snmp: Better type checking and output suppression * win_snmp: Fixed unset managers and communities * win_snmp: Fixed skipping default registry keys * win_snmp: Migrated to using add/set/remove action from replace * win_snmp: Fixed check mode * win_snmp: Fixed setting action and documentation. Expanded tests. * win_snmp: Efficiency changes and documentation cleanup * Added example of explicitly setting an empty set of managers to documentation * Made sure set will only remove items if there is a list of items provided. This list can be of length 0 * Improved efficiency in selecting next index for SNMP manager * Updated tests * win_snmp: Added output of permitted managers and community strings * win_snmp: Documentation fix
79 lines
2 KiB
Python
79 lines
2 KiB
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright: (c) 2018, Ansible, inc
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
ANSIBLE_METADATA = {
|
|
'metadata_version': '1.1',
|
|
'status': ['preview'],
|
|
'supported_by': 'community'
|
|
}
|
|
|
|
DOCUMENTATION = '''
|
|
---
|
|
module: win_snmp
|
|
version_added: '2.8'
|
|
short_description: Configures the Windows SNMP service
|
|
author:
|
|
- Michael Cassaniti (@mcassaniti)
|
|
description:
|
|
- This module configures the Windows SNMP service.
|
|
options:
|
|
permitted_managers:
|
|
description:
|
|
- The list of permitted SNMP managers.
|
|
type: list
|
|
community_strings:
|
|
description:
|
|
- The list of read-only SNMP community strings.
|
|
type: list
|
|
action:
|
|
description:
|
|
- C(add) will add new SNMP community strings and/or SNMP managers
|
|
- C(set) will replace SNMP community strings and/or SNMP managers. An
|
|
empty list for either C(community_strings) or C(permitted_managers)
|
|
will result in the respective lists being removed entirely.
|
|
- C(remove) will remove SNMP community strings and/or SNMP managers
|
|
default: set
|
|
choices: [ add, set, remove ]
|
|
'''
|
|
|
|
EXAMPLES = '''
|
|
---
|
|
- hosts: Windows
|
|
tasks:
|
|
- name: Replace SNMP communities and managers
|
|
win_snmp:
|
|
communities:
|
|
- public
|
|
managers:
|
|
- 192.168.1.2
|
|
action: set
|
|
|
|
- hosts: Windows
|
|
tasks:
|
|
- name: Replace SNMP communities and clear managers
|
|
win_snmp:
|
|
communities:
|
|
- public
|
|
managers: []
|
|
action: set
|
|
'''
|
|
|
|
RETURN = '''
|
|
community_strings:
|
|
description: The list of community strings for this machine
|
|
type: list
|
|
returned: always
|
|
sample:
|
|
- public
|
|
- snmp-ro
|
|
permitted_managers:
|
|
description: The list of permitted managers for this machine
|
|
type: list
|
|
returned: always
|
|
sample:
|
|
- 192.168.1.1
|
|
- 192.168.1.2
|
|
'''
|