summaryrefslogtreecommitdiff
path: root/lib/ansible/plugins/filter/urldecode.yml
blob: f63b3709b1237a805d5e4a116bfcfcf6ab0fdd64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
DOCUMENTATION:
  name: urlsplit
  version_added: "2.4"
  short_description: get components from URL
  description:
    - Given an URL, spiti it into it's component parts
  positional: _input, query
  options:
    _input:
      description: url string to split
      type: str
      required: true
    query:
      description: specify a single compoenent to return
      type: str
      choices: ["fragment", "hostname", "netloc", "password",  "path",  "port",  "query", "scheme",  "username"]

RETURN:
  _value:
    description: a dictionary with components as keyword and their value
    type: dict

EXAMPLES: |

    {{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit }}
    # =>
    #   {
    #       "fragment": "fragment",
    #       "hostname": "www.acme.com",
    #       "netloc": "user:password@www.acme.com:9000",
    #       "password": "password",
    #       "path": "/dir/index.html",
    #       "port": 9000,
    #       "query": "query=term",
    #       "scheme": "http",
    #       "username": "user"
    #   }

    {{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit('hostname') }}
    # => 'www.acme.com'

    {{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit('query') }}
    # => 'query=term'

    {{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit('path') }}
    # => '/dir/index.html'