diff --git a/uri b/uri index 7b0b28f6ab5..ddb2ffa685c 100644 --- a/uri +++ b/uri @@ -45,8 +45,7 @@ options: aliases: [] dest: description: - - path of where to download the file to (if desired). - - If I(dest) is a directory, the basename of the file on the remote server will be used. + - path of where to download the file to (if desired). If I(dest) is a directory, the basename of the file on the remote server will be used. required: false default: null user: @@ -61,7 +60,7 @@ options: default: null body: description: - - The body of the http request/response to the webservice. + - The body of the http request/response to the web service. required: false default: null method: @@ -75,7 +74,7 @@ options: - Whether or not to return the body of the request as a "content" key in the dictionary result. required: false choices: [ "yes", "no" ] - default: no + default: "no" force_basic_auth: description: - httplib2, the library used by the uri module only sends authentication information when a webservice @@ -84,13 +83,13 @@ options: upon initial request. required: false choices: [ "yes", "no" ] - default: no + default: "no" follow_redirects: description: - Whether or not the URI module should follow all redirects. required: false choices: [ "yes", "no" ] - default: no + default: "no" creates: description: - a filename, when it already exists, this step will not be run. @@ -112,6 +111,37 @@ options: description: - all arguments accepted by the M(file) module also work here required: false +examples: + - code: "uri: url=http://www.awesome.com" + description: "Check that you can connect (GET) to a page and it returns a status 200" + + - code: | + action: uri url=http://www.awesome.com return_content=yes + register: webpage + + action: fail + when_string: '"AWESOME" not in "${webpage.content}"' + + description: Check that a page returns a status 200 and fail if the word AWESOME is not in the page contents. + + - code: | + action: > + uri url=https://your.jira.server.com/rest/api/2/issue/ + method=POST user=your_username password=your_pass + body='$FILE(issue.json)' force_basic_auth=yes + status_code=201 HEADER_Content-Type="application/json" + description: "Create a JIRA issue." + + - code: | + action: > + uri url=https://your.form.based.auth.app.com/index.php + method=POST body="name=your_username&password=your_password&enter=Sign%20in" + status_code=302 HEADER_Content-Type="application/x-www-form-urlencoded" + register: login + + action: uri url=https://your.form.based.auth.app.com/dashboard.php method=GET return_content=yes HEADER_Cookie="${login.set_cookie}" + description: "Login to a form based webpage, then use the cookie that got returned to access the app in later tasks." + # informational: requirements for nodes requirements: [ urlparse, httplib2 ] author: Romeo Theriault