From 18b713fd74e0ecfd6c8d96ad05c45c0586d100c8 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Wed, 2 Apr 2014 17:32:44 -0400 Subject: [PATCH] Example cleanup. --- library/network/uri | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/library/network/uri b/library/network/uri index 3098c5f3902..b8b9b04ab9c 100644 --- a/library/network/uri +++ b/library/network/uri @@ -143,31 +143,29 @@ EXAMPLES = ''' when: 'AWESOME' not in "{{ webpage.content }}" -# Create a JIRA issue. -- action: > - uri url=https://your.jira.example.com/rest/api/2/issue/ - method=POST user=your_username password=your_pass - body="{{ lookup('file','issue.json') }}" force_basic_auth=yes - status_code=201 HEADER_Content-Type="application/json" - -- action: > - uri url=https://your.form.based.auth.examle.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 +# Create a JIRA issue + +- uri: url=https://your.jira.example.com/rest/api/2/issue/ + method=POST user=your_username password=your_pass + body="{{ lookup('file','issue.json') }}" force_basic_auth=yes + status_code=201 HEADER_Content-Type="application/json" # Login to a form based webpage, then use the returned cookie to -# access the app in later tasks. -- action: uri url=https://your.form.based.auth.example.com/dashboard.php - method=GET return_content=yes HEADER_Cookie="{{login.set_cookie}}" +# access the app in later tasks + +- uri: url=https://your.form.based.auth.examle.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 + +- uri: url=https://your.form.based.auth.example.com/dashboard.php + method=GET return_content=yes HEADER_Cookie="{{login.set_cookie}}" # Queue build of a project in Jenkins: -- action: uri url=http://{{jenkins.host}}/job/{{jenkins.job}}/build?token={{jenkins.token}} - method=GET user={{jenkins.user}} password={{jenkins.password}} force_basic_auth=yes status_code=201 -# Call Jenkins from host where you run ansible. Handy if the Jenkins host isn't reachable from the target machine: -- local_action: uri url=http://{{jenkins.host}}/job/{{jenkins.job}}/build?token={{jenkins.token}} - method=GET user={{jenkins.user}} password={{jenkins.password}} force_basic_auth=yes status_code=201 +- uri: url=http://{{jenkins.host}}/job/{{jenkins.job}}/build?token={{jenkins.token}} + method=GET user={{jenkins.user}} password={{jenkins.password}} force_basic_auth=yes status_code=201 + ''' HAS_HTTPLIB2 = True