On this page
community.network.pn_snmp_community – CLI command to create/modify/delete snmp-community
Note
This plugin is part of the community.network collection (version 3.0.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install community.network.
To use it in a playbook, specify: community.network.pn_snmp_community.
Synopsis
- This module can be used to create SNMP communities for SNMPv1 or delete SNMP communities for SNMPv1 or modify SNMP communities for SNMPv1.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| pn_cliswitch
        
        string
         | 
      
        
        Target switch to run the CLI on.
         | 
     |
| pn_community_string
        
        string
         | 
      
        
        community name.
         | 
     |
| pn_community_type
        
        string
         | 
      
       
  | 
      
        
        community type.
         | 
     
| state
        
        string / required
         | 
      
       
  | 
      
        
        State the action to perform. Use  present to create snmp-community and absent to delete snmp-community update to update snmp-community.
        | 
     
Examples
- name: Create snmp community
  community.network.pn_snmp_community:
    pn_cliswitch: "sw01"
    state: "present"
    pn_community_string: "foo"
    pn_community_type: "read-write"
- name: Delete snmp community
  community.network.pn_snmp_community:
    pn_cliswitch: "sw01"
    state: "absent"
    pn_community_string: "foo"
- name: Modify snmp community
  community.network.pn_snmp_community:
    pn_cliswitch: "sw01"
    state: "update"
    pn_community_string: "foo"
    pn_community_type: "read-only"
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| changed
        
        boolean
         | 
      always | 
        
        indicates whether the CLI caused changes on the target.
          | 
     
| command
        
        string
         | 
      always | 
        
        the CLI command run on the target node.
          | 
     
| stderr
        
        list / elements=string
         | 
      on error | 
        
        set of error responses from the snmp-community command.
          | 
     
| stdout
        
        list / elements=string
         | 
      always | 
        
        set of responses from the snmp-community command.
          | 
     
Authors
- Pluribus Networks (@rajaspachipulusu17)
 
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/latest/collections/community/network/pn_snmp_community_module.html