aruba / aruba-ansible-modules

Aruba Ansible Modules
Apache License 2.0
80 stars 36 forks source link

output truncated command with msg: "this operation can take a while depending on number of users. Please be patient.." #35

Closed nnorakk closed 5 years ago

nnorakk commented 5 years ago

I modified show_command.yml example to list clients like:

- name: Sample playbook to execute a show command and get all the configuration of a node
  hosts: localhost
  connection: local
  gather_facts: no
  vars_files:
    - variables.txt
  tasks:
    - name: Execute a show version command
      arubaos_controller_config:
        host: "{{ mm_ip }}"
        username: "{{ mm_username }}"
        password: "{{ mm_password }}"
        method: "GET"
        config_path: "{{ configuration_path }}"
        api_name: showcommand
        data: { "command": "show user name 001695161738" }

When I run:

ansible-playbook -i inventory.txt show_commands.yml -vvvv

I do not get list but the answer: "This operation can take a while depending on nubmer of users. Please be patient ..."

ok: [localhost] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "api_name": "showcommand",
            "config_path": "/mm/mynode",
            "data": {
                "command": "show user name 001584161627"
            },
            "host": "10.16.121.253",
            "method": "GET",
            "password": "Caval0!@",
            "username": "admin"
        }
    },
    "msg": [
        "This operation can take a while depending on number of users. Please be patient ...."
    ],
    "response": {
        "_data": [
            "This operation can take a while depending on number of users. Please be patient ...."
        ]
    },
    "status_code": 200
}
karthikeyan-dhandapani commented 5 years ago

Hi nnorakk,

Do you see this response consistently or once in a while?

At this point, the showcommand api has its limitations. We will raise a ticket. But for the time being, if you really need the showcommand output, you could use SSH/CLI based tasks in your ansible playbook along with the REST API tasks.

You could use aruba_command and aruba_config ansible modules which is present in your ansible installation. If the AOS version of you controller is 8.x+, you need to make this fix by yourself, as it is not merged to ansible github yet.

Fix for AOS8.X, SSH/CLI based Aruba module, https://github.com/ansible/ansible/pull/54261/commits

Dev Forum Discussion, https://community.arubanetworks.com/t5/Developer-Community/Ansible-Controller-Issues-Examples/td-p/548574

Sample Playbook with aruba_command API, (If the command output takes a while to appear, you could increase the timeout in the provider)

- name: Sample Playbook for mobility master SSH command
  hosts: controller
  connection: local
  gather_facts: no
  vars_files:
    - mm_variables.yml

  tasks:
     - name: CLI task for show user command
       aruba_command:
         commands: "show user name 001584161627"
         interval: 300
         provider: "{{ provider }}"

Sample Variable File

provider:
   username: "admin"
   password: "admin"
   host:   "1.1.1.1"
   timeout: 360
tchiapuziowong commented 5 years ago

closing issue due to workaround being provided and no update