gcp_compute – Google Cloud Compute Engine inventory source¶
Synopsis¶
- Get inventory hosts from Google Cloud Platform GCE.
- Uses a YAML configuration file that ends with gcp_compute.(yml|yaml) or gcp.(yml|yaml).
Requirements¶
The below requirements are needed on the local master node that executes this inventory.
- requests >= 2.18.4
- google-auth >= 1.3.0
Parameters¶
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
auth_kind
-
|
The type of credential used.
|
||
cache
boolean
|
Default: "no"
|
ini entries:
[inventory] env:ANSIBLE_INVENTORY_CACHE
|
Toggle to enable/disable the caching of the inventory's source data, requires a cache plugin setup to work.
|
cache_connection
-
|
ini entries:
[inventory] env:ANSIBLE_INVENTORY_CACHE_CONNECTION
|
Cache connection data or path, read cache plugin documentation for specifics.
|
|
cache_plugin
-
|
ini entries:
[inventory] env:ANSIBLE_INVENTORY_CACHE_PLUGIN
|
Cache plugin to use for the inventory's source data.
|
|
cache_timeout
integer
|
Default: 3600
|
ini entries:
[inventory] env:ANSIBLE_INVENTORY_CACHE_TIMEOUT
|
Cache duration in seconds
|
compose
dictionary
|
Default: {}
|
create vars from jinja2 expressions
|
|
filters
-
|
A list of filter value pairs. Available filters are listed here https://cloud.google.com/compute/docs/reference/rest/v1/instances/list. Each additional filter in the list will act be added as an AND condition (filter1 and filter2)
|
||
groups
dictionary
|
Default: {}
|
add hosts to group based on Jinja2 conditionals
|
|
hostnames
-
|
Default: ["public_ip", "private_ip", "name"]
|
A list of options that describe the ordering for which hostnames should be assigned. Currently supported hostnames are 'public_ip', 'private_ip', or 'name'.
|
|
keyed_groups
list
|
Default: []
|
add hosts to group based on the values of a variable
|
|
plugin
-
/ required
|
|
token that ensures this is a source file for the 'gcp_compute' plugin.
|
|
projects
-
|
A list of projects in which to describe GCE instances.
|
||
service_account_email
-
|
An optional service account email address if machineaccount is selected and the user does not wish to use the default email.
|
||
service_account_file
-
|
The path of a Service Account JSON file if serviceaccount is selected as type.
|
||
strict
boolean
|
Default: "no"
|
If true make invalid entries a fatal error, otherwise skip and continue
Since it is possible to use facts in the expressions they might not always be available and we ignore those errors by default.
|
|
zones
-
|
Default: "all zones available to a given project"
|
A list of regions in which to describe GCE instances.
|
Examples¶
plugin: gcp_compute
zones: # populate inventory with instances in these regions
- us-east1-a
projects:
- gcp-prod-gke-100
- gcp-cicd-101
filters:
- machineType = n1-standard-1
- scheduling.automaticRestart = true AND machineType = n1-standard-1
scopes:
- https://www.googleapis.com/auth/compute
service_account_file: /tmp/service_account.json
auth_kind: serviceaccount
Status¶
Authors¶
- UNKNOWN
Hint
If you notice any issues in this documentation you can edit this document to improve it.