@ -1,7 +1,7 @@
#!/usr/bin/python
#!/usr/bin/python
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# (c) 2015, Corwin Brown < blakfeld@gmail .com>
# (c) 2015, Corwin Brown < corwin.brown@maxpoint .com>
#
#
# This file is part of Ansible
# This file is part of Ansible
#
#
@ -24,7 +24,7 @@
DOCUMENTATION = """
DOCUMENTATION = """
- - -
- - -
module : win_uri
module : win_uri
version_added : " 2. 0 "
version_added : " 2. 1 "
short_description : Interacts with webservices .
short_description : Interacts with webservices .
description :
description :
- Interacts with HTTP and HTTPS services .
- Interacts with HTTP and HTTPS services .
@ -32,12 +32,10 @@ options:
url :
url :
description :
description :
- HTTP or HTTPS URL in the form of ( http | https ) : / / host . domain : port / path
- HTTP or HTTPS URL in the form of ( http | https ) : / / host . domain : port / path
required : true
method :
method :
description :
description :
- The HTTP Method of the request or response .
- The HTTP Method of the request or response .
default : GET
default : GET
required : false
choices :
choices :
- GET
- GET
- POST
- POST
@ -55,17 +53,20 @@ options:
body :
body :
description :
description :
- The body of the HTTP request / response to the web service .
- The body of the HTTP request / response to the web service .
required : false
default : None
headers :
headers :
description :
description :
- Key Value pairs for headers . Example " Host: www.somesite.com "
- Key Value pairs for headers . Example " Host: www.somesite.com "
required : false
use_basic_parsing :
default : None
description :
- This module relies upon ' Invoke-WebRequest ' , which by default uses the Internet Explorer Engine to parse a webpage . There ' s an edge-case where if a user hasn ' t run IE before , this will fail . The only advantage to using the Internet Explorer praser is that you can traverse the DOM in a powershell script . That isn ' t useful for Ansible, so by default we toggle ' UseBasicParsing ' . However, you can toggle that off here.
choices :
- True
- False
default : True
author : Corwin Brown ( @blakfeld )
author : Corwin Brown ( @blakfeld )
"""
"""
Examples = """
E XAMPLES = """
# Send a GET request and store the output:
# Send a GET request and store the output:
- - -
- - -
- name : Perform a GET and Store Output
- name : Perform a GET and Store Output
@ -96,19 +97,52 @@ Examples = """
url : http : / / www . somesite . com
url : http : / / www . somesite . com
method : POST
method : POST
body : " { ' some ' : ' json ' } "
body : " { ' some ' : ' json ' } "
"""
# Check if a file is available on a webserver
RETURN = """
- - -
url :
- name : Ensure Build is Available on Fileserver
description : The Target URL
when : ensure_build
returned : always
win_uri :
type : string
url : " http://www.somesite.com "
sample : " http://www.ansible.com "
method : HEAD
method :
headers :
description : The HTTP method used .
test : one
returned : always
another : two
type : string
register : build_check_output
sample : " GET "
until : build_check_output . StatusCode == 200
content_type :
retries : 30
description : The " content-type " header used .
delay : 10
returned : always
type : string
sample : " application/json "
use_basic_parsing :
description : The state of the " use_basic_parsing " flag .
returned : always
type : bool
sample : True
StatusCode :
description : The HTTP Status Code of the response .
returned : success
type : int
sample : 200
StatusDescription :
description : A summery of the status .
returned : success
type : string
stample : " OK "
RawContent :
description : The raw content of the HTTP response .
returned : success
type : string
sample : ' HTTP/1.1 200 OK \n X-XSS-Protection: 1; mode=block \n X-Frame-Options: SAMEORIGIN \n Alternate-Protocol: 443:quic,p=1 \n Alt-Svc: quic= " www.google.com:443 " ; ma=2592000; v= " 30,29,28,27,26,25 " ,quic= " :443 " ; ma=2... '
Headers :
description : The Headers of the response .
returned : success
type : dict
sample : { " Content-Type " : " application/json " }
RawContentLength :
description : The byte size of the response .
returned : success
type : int
sample : 54447
"""
"""