commit 8cc971072132f384630a11ca5c244f27a046ac98 Author: Haug, Christoph Date: Mon May 23 12:48:00 2022 +0200 Initial commit diff --git a/tasks/ip_authorization.yml b/tasks/ip_authorization.yml new file mode 100644 index 0000000..1a120b0 --- /dev/null +++ b/tasks/ip_authorization.yml @@ -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 \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..9674657 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- name: Set IP authorized_managers + import_tasks: ip_authorization.yml \ No newline at end of file diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..bc4352b --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,3 @@ +ansible_become: yes +ansible_connection: ansible.netcommon.network_cli +ansible_network_os: aruba \ No newline at end of file