Developer

 View Only
last person joined: yesterday 

Expand all | Collapse all

Ansible and output of arubainstant_config

This thread has been viewed 4 times
  • 1.  Ansible and output of arubainstant_config

    Posted Apr 21, 2020 09:13 AM

    Hi 

    is there a way to have a nicer output from Ansible if you do a "show network" on a IAP via REST API ? At the moment it looks like this.

    And you have to use the ugly "-v" extension on the command to get any output at all.

    ansible-playbook play.yml -i /etc/ansible/hosts -v

    Using /etc/ansible/ansible.cfg as config file

     

    PLAY [Show existing network] **********************************************************************************************************************************************************************************************************************************************

     

    TASK [Show existing network as a show command through API] ****************************************************************************************************************************************************************************************************************

    [WARNING]: Module did not set no_log for password

    [WARNING]: Platform linux on host 192.168.100.31 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See

    https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.

    changed: [192.168.100.31] => changed=true 

      ansible_facts:

        discovered_interpreter_python: /usr/bin/python

      msg: '{u''Status'': u''Success'', u''CLI Command executed'': u''show network
    '', u''IAP IP address'': u''192.168.100.31'', u''Command output'': u''cli output:

    COMMAND=show network
    \r
    Networks
    --------
    Profile Name  ESSID             Clients  Type      Band  Authentication Method  Key Management  IP Assignment  Status   Zone  Coding   Active  Max IPv4 Users
    ------------  -----             -------  ----      ----  ---------------------  --------------  -------------  ------   ----  ------   ------  --------------
    SetMeUp       SetMeUp-C1:AE:C5  0        employee  2.4   None                   none            NAT Mode       Enabled  -     Default  Yes     N/A'', u''Status-code'': 0}'

      status_code: 200

     

    my playbook looks like this.

    - name: Show existing network

      hosts: aruba_ap315

      connection: local

      gather_facts: no

      tasks:

        - name: Show existing network as a show command through API

          arubainstant_config:

            host: 192.168.100.31

            username: admin

            password: admin

            method: GET

            iap_ip_addr: 192.168.100.31

            api_type: monitoring

            api_name: show network

     

    what i wan to have is:

    show network

     

    Networks

    --------

    Profile Name  ESSID             Clients  Type      Band  Authentication Method  Key Management  IP Assignment  Status   Zone  Coding   Active  Max IPv4 Users

    ------------  -----             -------  ----      ----  ---------------------  --------------  -------------  ------   ----  ------   ------  --------------

    SetMeUp       SetMeUp-C1:AE:C5  0        employee  2.4   None                   none            NAT Mode       Enabled  -     Default  Yes     N/A

     

     

    Tried to use a register variable and output.stdout it but register is not supported by this module .

    Regards Markus

     

     

     

     



  • 2.  RE: Ansible and output of arubainstant_config

    MVP GURU
    Posted Apr 24, 2020 10:14 AM

    Hi Markus,

     

    What do you need to make ? because ansible is not specific make for display stuff...



  • 3.  RE: Ansible and output of arubainstant_config

    Posted Apr 27, 2020 01:41 AM

    Hi

    I think if I can send show commands to a AP via API it is worth to see the Output readable like on the CLI.

     

    who needs powershell if you have a nice Bash



  • 4.  RE: Ansible and output of arubainstant_config

    EMPLOYEE
    Posted Apr 28, 2020 07:09 PM

    You can use:  | sed 's/\
    /
    /g'
    with ansible-playbook command to get an output similar to what you are looking for.

    Eg: ansible-plabook filename.yml -v | sed 's/\
    /
    /g'