About
Http request in Ansible
List
Management
Check a page
- name: Check that a page returns a status 200 and fail if the word AWESOME is not in the page contents
uri:
url: http://www.example.com
return_content: yes
register: this
failed_when: "'AWESOME' not in this.content"
Fill a form
- name: Login to a form based webpage using a list of tuples
uri:
url: https://your.form.based.auth.example.com/index.php
method: POST
body_format: form-urlencoded
body:
- [ name, your_username ]
- [ password, your_password ]
- [ enter, Sign in ]
status_code: 302
register: login
Download a file with basic authentication
uri:
url: 'https://example.com/file'
method: GET
force_basic_auth: yes
dest: '/tmp/file'
url_username: 'admin'
url_password: 'admin123'