title: Fetch specific output from stdout_lines and store it in a list
body: <p>I'm working on automating F5 BIG IP configuration decommission.I need to fetch the pool names from the executed arbitrary bigip command. I have stored the content of the output  to a register and wanted to fetch the pool name and store it in a list.</p>
  
  <p>I have achieved till obtaining the wide ip information (which contains Pool name) from the output of the executed command.</p>
  
  <p>Expected output :-</p>
  
  <p>Can i use any Regular expression to fetch the pool information , as far as i know i can do a dot walk to fetch the exact content from JSON . I'm pretty much sure that the output won't be same when there are multiple pool names . What would be the logic if there are multiple pools as well ?</p>
  
  <pre><code>---
  - name: Playbook to verify the Wideip and fetch the GTM configuration
    hosts: test-gtm.com
    connection: local
    gather_facts: no
  
    tasks:
  
      - name: Verify WideIP Exists
        bigip_command:
          user: admin
          password: admin
          commands: "list gtm wideip a wideip"
          validate_certs: no
        register: output
        delegate_to: localhost
  
      - debug:
          var: output
  
      - name: Fetch the Pool name from the WideIP
        set_fact:
          gtm_pool: "{{ output.stdout_lines[0][1].split()[0] }}"
  
  ``
  
  Output without the dot walk :-
  
  "stdout_lines": [
              [
                  "gtm wideip a test.abc.com {", 
                  "    pools {", 
                  "        test-pool {", 
                  "            order 0", 
                  "        }", 
                  "    }", 
                  "}"
              ]
  
  
  Whole  debug output :-
  
  
  
          "output": {
          "changed": false, 
          "deprecations": [
              {
                  "msg": "Param 'server' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }, 
              {
                  "msg": "Param 'user' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }, 
              {
                  "msg": "Param 'password' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }, 
              {
                  "msg": "Param 'validate_certs' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }
          ], 
          "executed_commands": [
              "tmsh -c \\\"list gtm wideip a wideip\\\""
          ], 
          "failed": false, 
          "stdout": [
              "gtm wideip a wideip {\n    pools {\n        test-pool {\n            order 0\n        }\n    }\n}"
          ], 
          "stdout_lines": [
              [
                  "gtm wideip a wideip {", 
                  "    pools {", 
                  "        test-pool {", 
                  "            order 0", 
                  "        }", 
                  "    }", 
                  "}"
              ]
          ]
      }
  }
  
  
  
  
  
  Debug output consisting of more than single pool:-
  
  ok: [device.abc.com] =&gt; {
      "output": {
          "changed": false, 
          "deprecations": [
              {
                  "msg": "Param 'server' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }, 
              {
                  "msg": "Param 'user' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }, 
              {
                  "msg": "Param 'password' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }, 
              {
                  "msg": "Param 'validate_certs' is deprecated. See the module docs for more information", 
                  "version": 2.9
              }
          ], 
          "executed_commands": [
              "tmsh -c \\\"list gtm wideip a wideip\\\""
          ], 
          "failed": false, 
          "stdout": [
              "gtm wideip a wideip {\n    description wideip\n    pool-lb-mode topology\n    pools {\n        test1-pool {\n            order 1\n        }\n        test2-pool {\n            order 0\n        }\n    }\n}"
          ], 
          "stdout_lines": [
              [
                  "gtm wideip a wideip {", 
                  "    description wideip", 
                  "    pool-lb-mode topology", 
                  "    pools {", 
                  "        test1-pool {", 
                  "            order 1", 
                  "        }", 
                  "        test2-pool {", 
                  "            order 0", 
                  "        }", 
                  "    }", 
                  "}"
              ]
          ]
  
  </code></pre>