Documentation

gcp_url_map - Create, Update or Destory a Url_Map.

New in version 2.4.

Synopsis

Requirements (on host that executes module)

  • python >= 2.6
  • google-api-python-client >= 1.6.2
  • google-auth >= 0.9.0
  • google-auth-httplib2 >= 0.0.2

Options

parameter required default choices comments
default_service
yes
Default Backend Service if no host rules match.
host_rules
no
The list of HostRules to use against the URL. Contains a list of hosts and an associated path_matcher.
The 'hosts' parameter is a list of host patterns to match. They must be valid hostnames, except * will match any string of ([a-z0-9-.]*). In that case, * must be the first character and must be followed in the pattern by either - or ..
The 'path_matcher' parameter is name of the PathMatcher to use to match the path portion of the URL if the hostRule matches the URL's host portion.
path_matchers
no
The list of named PathMatchers to use against the URL. Contains path_rules, which is a list of paths and an associated service. A default_service can also be specified for each path_matcher.
The 'name' parameter to which this path_matcher is referred by the host_rule.
The 'default_service' parameter is the name of the BackendService resource. This will be used if none of the path_rules defined by this path_matcher is matched by the URL's path portion.
The 'path_rules' parameter is a list of dictionaries containing a list of paths and a service to direct traffic to. Each path item must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or
url_map_name
yes
Name of the Url_Map.

Examples

- name: Create Minimal Url_Map
  gcp_url_map:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    url_map_name: my-url_map
    default_service: my-backend-service
    state: present
- name: Create UrlMap with pathmatcher
  gcp_url_map:
    service_account_email: "{{ service_account_email }}"
    credentials_file: "{{ credentials_file }}"
    project_id: "{{ project_id }}"
    url_map_name: my-url-map-pm
    default_service: default-backend-service
    path_matchers:
    - name: 'path-matcher-one'
      description: 'path matcher one'
      default_service: 'bes-pathmatcher-one-default'
      path_rules:
      - service: 'my-one-bes'
        paths:
        - '/data'
        - '/aboutus'
    host_rules:
      - hosts:
        - '*.'
        path_matcher: 'path-matcher-one'
    state: "present"

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
host_rules List of HostRules. If specified. dict [{'path_matcher': 'my-pm', 'hosts': ['*.']}]
url_map_name Name of the Url_Map Always str my-url-map
updated_url_map True if the url_map has been updated. Will not appear on initial url_map creation. if the url_map has been updated. bool True
url_map GCP Url_Map dictionary Always. Refer to GCP documentation for detailed field descriptions. dict {'pathMatchers': ['...'], 'name': 'my-url-map', 'hostRules': ['...']}
path_matchers The list of named PathMatchers to use against the URL. If specified. dict [{'name': 'my-pm', 'service': 'my-service', 'path_rules': [{'paths': ['/data']}]}]
state state of the Url_Map Always. str present


Notes

Note

  • Only supports global Backend Services.
  • Url_Map tests are not currently supported.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.