How can I set the content of a variable to the result of a HTTP call?

Solution 1:

Ok, got it. Using the command module I was able to cat the file to be able to read in the contents of the downloaded file.

- name: Get App Version
  get_url:
    url: "{{ artifactory_search }}?g=com.test.app&a=my-app&v=*qa*&repos=libs-release-local"
    dest: "{{ app_dir }}/version"
- name: Read App Version
  command: cat {{ app_dir }}/version
  register: app_version
- debug:
    msg: "App Version {{ app_version.stdout }}"

Solution 2:

You can also use the uri module like so:

- name: Fetch instance metadata
  uri:
    url: http://169.254.169.254/path/to/ip_address
    return_content: yes
  register: jsondata

- debug: msg="Operating on instance {{ jsondata['content'] }}"