google.cloud.gcp_parameter_manager module – Access and Update Google Cloud Parameter Manager objects
Note
This module is part of the google.cloud collection (version 1.7.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install google.cloud
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: google.cloud.gcp_parameter_manager
.
Synopsis
Access and Update Google Cloud Parameter Manager objects
Create new parameters.
Create new parameters with format.
Create new parameters with labels.
Create new parameters with format and labels.
Add/Remove parameter version.
Remove parameter.
Requirements
The below requirements are needed on the host that executes this module.
python >= 3.7
requests >= 2.32.3
google-auth >= 2.39.0
Parameters
Parameter |
Comments |
---|---|
An OAuth2 access token if credential type is accesstoken. |
|
The type of credential used. Choices:
|
|
Specifies which Ansible environment you’re running this module within. This should not be set unless you know what you’re doing. This only alters the User Agent string for any API requests. |
|
Format of the parameter to be used. Choices:
|
|
A set of key-value pairs to assign as labels to a parameter only used in creation Note that the “value” piece of a label must contain only readable chars Default: |
|
Location of the parameter to be used Default: |
|
Name of the parameter to be used |
|
The Google Cloud Platform project to use. Defaults to OS env variable GCP_PROJECT if not present |
|
if true, the value of the parameter will be returned unencrypted to Ansible if false, no value will be returned or decrypted Choices:
|
|
Array of scopes to be used |
|
The contents of a Service Account JSON file, either in a dictionary or as a JSON string that represents it. |
|
An optional service account email address if machineaccount is selected and the user does not wish to use the default email. |
|
The path of a Service Account JSON file if serviceaccount is selected as type. |
|
whether the parameter should exist Choices:
|
|
The parameter value that the parameter should have this will be set upon create If the parameter value is not this, a new version will be added with this value |
|
Name of the parameter to be used |
Examples
- name: Create a new parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new parameter with version
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new structured parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Create a structured parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Ensure the parameter exists, fail otherwise and return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
- name: Ensure parameter exists but don't return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
return_value: false
- name: Add a new version of a parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: updated super parameter
state: present
- name: Delete version 1 of a parameter (but not the parameter itself)
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
state: absent
- name: Delete parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: absent
- name: Create a new regional parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new regional parameter with version
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a new structured regional parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
- name: Create a regional parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: super_parameter
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Create a structured regional parameter with labels
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
format: JSON
value: '{"key":"value"}'
state: present
auth_kind: serviceaccount
service_account_file: service_account_creds.json
labels:
key_name: "ansible_rox"
- name: Ensure the regional parameter exists, fail otherwise and return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
- name: Ensure regional parameter exists but don't return the value
google.cloud.gcp_parameter_manager:
name: parameter_key
state: present
return_value: false
- name: Add a new version of a regional parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
value: updated super parameter
state: present
- name: Delete version 1 of a regional parameter (but not the regional parameter itself)
google.cloud.gcp_parameter_manager:
name: parameter_key
version: version_key
state: absent
- name: Delete parameter
google.cloud.gcp_parameter_manager:
name: parameter_key
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
List of resources Returned: always |
|
The location of the regional parameter Returned: success |
|
A message indicating what was done (or not done) Returned: success, failure |
|
The name of the parameter Returned: success |
|
The base 64 parameter payload Returned: success |
|
the HTTP status code of the response to Google Cloud Returned: success |
|
the Google Cloud URL used to make the request Returned: success |
|
The decrypted parameter data value, please use care with this Returned: success |
|
the version of the parameter returned Returned: success |