ios_acl 模块
只允许 本地访问设备的22端口:ip access-list extended test permit tcp 10.255.200.100 0.0.0.0 10.255.200.254 0.0.0.0 eq 22
·剧本:
---- name: acl hosts: HQ-IR1,HQ-DS1,HQ-AS1 gather_facts: false tasks: - name: acl cisco.ios.ios_acls: config: - afi: ipv4 acls: - name: test acl_type: extended aces: - grant: permit protocol: tcp source: address: 10.255.200.100 wildcard_bits: 0.0.0.0 destination: address: "{{ ansible_host }}" wildcard_bits: 0.0.0.0 port_protocol: eq: 22 - grant: permit protocol: ip source: address: any destination: address: any state: replaced - name: Enable acl ios_config: lines: ip access-group test in parents: inter loop 0