snmp_config.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Configure SNMP
  16. block:
  17. - name: Set parameters for SNMP configuration
  18. set_fact:
  19. os10_snmp:
  20. snmp_community:
  21. - name: "{{ snmp_community_name }}"
  22. access_mode: ro
  23. state: present
  24. snmp_traps:
  25. - name: all
  26. state: present
  27. snmp_host:
  28. - ip: "{{ snmp_trap_destination }}"
  29. communitystring: "{{ snmp_community_name }}"
  30. version: "1"
  31. state: present
  32. when: snmp_trap_destination | length > 1
  33. - name: Apply SNMP configuration
  34. include_role:
  35. name: dellemc.os10.os10_snmp
  36. vars:
  37. - hostname: "{{ inventory_hostname }}"
  38. os10_cfg_generate: true
  39. when: os10_snmp is defined