arubaoss_config and multiple switches
chr00ted opened this issue · 3 comments
I have backups working with the following play listed below. The problem is if I run this against multiple switches, the last one is the only config saved. I tried changing the filename to: "{{ hostname }}-backup.txt with no luck. How can I get the filename to save as hostname so I can backup multiple switches? Thanks in advance!
- hosts: all
collections:- arubanetworks.aos_switch
gather_facts: False
vars:
ansible_connection: network_cli
tasks: - name: Backup config to local file
arubaoss_config:
backup: True
backup_options:
filename: backup.txt
dir_path: /path/to
- arubanetworks.aos_switch
I tried:
- name: Gather hostname
arubaoss_facts:
gather_subset:
- host_name
register: facts_subset_output- name: Backup config to local file
arubaoss_config:
backup: True
backup_options:
filename: "{{ ansible_net_hostname }}-backup.txt"
- name: Backup config to local file
I think part of the issue is my user is unable to logon to the web interface. I setup the ansible user as follows:
aaa authentication local-user "ansible" group "Level-15"
The user ansible can logon via ssh, but its unable to access the GUI. Normally I would not care as I dont use the web interface, but it looks as though arubaoss_config uses restapi? What do I need to do to allow my ansible user to also use the webapi/web interface.
Any help is appreciated
Add {{ inventory_hostname_short }} as part of the filename.
https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html
Thanks @borgermeister, that worked