title: grep url from text and access in ansible
body: <p>Team, </p>
  
  <p>I have a text file containing the url that I need to launch using uri anisible module and capture its result to check http_status code is 200 or not. my playbook is below but I am getting error:</p>
  
  <p>The same work when I use a defined variable from the vars file. but it does not work when I use it from the output of GREP result. if I switch my comment it works. that is if I use </p>
  
  <pre><code>url: https://'{{ site_from_vars_file }}'
  </code></pre>
  
  <pre><code>-
    name: Test connectivity to target servers
    hosts: all
    vars_files:
             - vars.yaml
        - name: "GREP API server name..  "
          shell: "grep 443 $HOME/.kube/config/cluster-user.kubeconfig | awk -F '//' '{print $2}'"
          register: grep_output
          ignore_errors: true
        - debug:
            var: grep_output.stdout_lines
          when: grep_output.stdout != ''
  
        - name: "Validate site reachability response as 200 okay  "
          uri:
            #url: https://'{{ site_from_vars_file }}'
            url: https://'{{ grep_output }}'
            return_content: yes
            validate_certs: no
          register: uri_output
          failed_when: uri_output.status not in [200]
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>TASK [Gathering Facts] ****************************************************************************************************************************************
  ok: [target1]
  
  TASK [DNS test] ***********************************************************************************************************************************************
  changed: [target1]
  
  TASK [Validate DNS server] ************************************************************************************************************************************
  ok: [target1] =&gt; {
      "msg": "Resolved DNS server 'site.test.com' '69.172.200.109' "
  }
  
  TASK [GREP API server name..] *********************************************************************************************************************************
  changed: [target1]
  
  TASK [debug] **************************************************************************************************************************************************
  ok: [target1] =&gt; {
      "grep_output.stdout_lines": [
          "site.test.com:443"
      ]
  }
  
  TASK [Validate site reachability response as 200 okay] ***************************************************************************************
  fatal: [target1]: FAILED! =&gt; {"changed": false, "failed_when_result": true, "msg": "invalid literal for int() with base 10: \"True, 'end'\"", "status": -1, "url": "https://'{'changed': True, 'end': '2019-09-27 16:52:08.250231', 'stdout': 'site.test.com:443', 'cmd': \"grep 443 $HOME/.kube/config/cluster-user.kubeconfig | awk -F '//' '{print $2}'\", 'rc': 0, 'start': '2019-09-27 16:52:08.241668', 'stderr': '', 'delta': '0:00:00.008563', 'stdout_lines': ['site.test.com:443'], 'stderr_lines': [], 'failed': False}'"}
  
  PLAY RECAP ****************************************************************************************************************************************************
  target1                    : ok=5    changed=2    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
  </code></pre>