ansible / ansible.builtin / v2.8.18 / lookup / url return contents from URL | "added in version" 1.9 of ansible.builtin" Authors: Brian Coca (@bcoca)ansible.builtin.url (v2.8.18) — lookup
pip
Install with pip install ansible==2.8.18
Returns the content of the URL requested to be used as data in play.
- name: url lookup splits lines by default debug: msg="{{item}}" loop: "{{ lookup('url', 'https://github.com/gremlin.keys', wantlist=True) }}"
- name: display ip ranges debug: msg="{{ lookup('url', 'https://ip-ranges.amazonaws.com/ip-ranges.json', split_lines=False) }}"
- name: url lookup using authentication debug: msg="{{ lookup('url', 'https://some.private.site.com/file.txt', username='bob', password='hunter2') }}"
_terms: description: urls to query password: default: None description: Password to use for HTTP authentication. type: string version_added: '2.8' version_added_collection: ansible.builtin username: default: None description: Username to use for HTTP authentication. type: string version_added: '2.8' version_added_collection: ansible.builtin use_proxy: default: true description: Flag to control if the lookup will observe HTTP proxy environment variables when present. type: boolean split_lines: default: true description: Flag to control if content is returned as a list of lines or as a single text blob type: boolean validate_certs: default: true description: Flag to control SSL certificate validation type: boolean
_list: description: list of list of lines or content of url(s)