Initial commit

This commit is contained in:
Haug, Christoph 2022-05-23 12:48:00 +02:00
commit 8cc9710721
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,20 @@
---
- 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

3
tasks/main.yml Normal file
View File

@ -0,0 +1,3 @@
---
- name: Set IP authorized_managers
import_tasks: ip_authorization.yml

3
vars/main.yml Normal file
View File

@ -0,0 +1,3 @@
ansible_become: yes
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: aruba