#
#  docker run --rm -v .:/work -v c:\\cygwin64\\home\\johnp\\git\\scsd\\ct-noc-config-backups:/configs -it ansiblecx ansible-playbook  -i inventory.scsd.yml backup_configs.yml
#
# podman run --rm -v .:/work -v ../ct-noc-config-backups:/configs -it ansiblecx ansible-playbook  -i inventory.scsd.yml backup_configs.yml
#
- hosts: all
  collections:
    - arubanetworks.aoscx
  gather_facts: False
  vars:
    ansible_connection: network_cli
  tasks:
    - name: show running config
      aoscx_command:
        commands:
          - show run
      register: show_run
      
    - name:
      ansible.builtin.file:
        path: /configs/{{building_name}}
        state: directory

    - name: output
      copy:
        content: "{{show_run.stdout[0]}}"
        dest: /configs/{{building_name}}/{{inventory_hostname}}.cfg
        
