Deprecated

Removed in 2.0.0

i

Reason:Updated modules released with increased functionality | Alternative:Use M(google.cloud.gcp_compute_url_map) instead.

community.general.gcp_url_map (1.3.14) — module

Create, Update or Destroy a Url_Map.

Authors: Tom Melendez (@supertom) <tom@supertom.com>

Install collection

Install with ansible-galaxy collection install community.general:==1.3.14


Add to requirements.yml

  collections:
    - name: community.general
      version: 1.3.14

Description

Create, Update or Destroy a Url_Map. See U(https://cloud.google.com/compute/docs/load-balancing/http/url-map) for an overview. More details on the Url_Map API can be found at U(https://cloud.google.com/compute/docs/reference/latest/urlMaps#resource).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create Minimal Url_Map
  community.general.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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create UrlMap with pathmatcher
  community.general.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"

Inputs

    
state:
    choices:
    - present
    - absent
    default: present
    description: The state the URL map should be in. C(present) or C(absent) are the only
      valid options.
    required: false
    type: str

pem_file:
    description:
    - The path to the PEM file associated with the service account email.
    - This option is deprecated and may be removed in a future release. Use I(credentials_file)
      instead.
    type: str

host_rules:
    description:
    - 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.
    required: false
    type: list

project_id:
    description:
    - The Google Cloud Platform project ID to use.
    type: str

url_map_name:
    description:
    - Name of the Url_Map.
    required: true
    type: str

path_matchers:
    description:
    - 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
    required: false
    type: list

default_service:
    description:
    - Default Backend Service if no host rules match.
    required: true
    type: str

credentials_file:
    description:
    - The path to the JSON file associated with the service account email.
    type: str

service_account_email:
    description:
    - service account email
    type: str

service_account_permissions:
    description:
    - service account permissions
    type: list

Outputs

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