Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
394 B
4
Indexable
Never
---
- name: Configure SNMP access
  hosts: all
  become: true
  
  vars:
    snmp_allowed_ips:
      - 192.168.1.10
      - 192.168.2.20
  
  tasks:
    - name: Allow SNMP traffic from specified IPs
      iptables:
        chain: INPUT
        protocol: udp
        destination_port: 161
        source: "{{ item }}"
        jump: ACCEPT
      loop: "{{ snmp_allowed_ips }}"