aruba_config/tasks/ip_authorization.yml

20 lines
810 B
YAML

---
- name: get ip authorized-managers
community.network.aruba_command:
commands: show running-config | include ip authorized-managers
register: result
- name: Get IP's
set_fact:
ip_auth_command: "{{ result.stdout_lines[0] | select('match', regex) | map('regex_replace',regex,replace) | unique | map('regex_replace', '^', 'no ip authorized-managers ') | list }}"
vars:
regex: '^.*managers (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*$'
replace: '\1'
- name: set ip authorized managers
set_fact:
ip_auth_command: "{{ip_auth_command + ['ip authorized-managers '+item.network+' access manager access-method '+item.access_method]}}"
loop: "{{ip_authorization}}"
- name: send command
community.network.aruba_config:
lines: "{{ip_auth_command}}"
match: none
save_when: always