GCP+Ansible: how to run a playbook with user account
No. Ansible google.cloud credentials must be service accounts.
Refer to the Ansible GCE Guide. auth_kind
only changes how this service account is looked up:
-
serviceaccount
Use the account fromservice_account_file
orservice_account_contents
. This one is possibly the easiest to use. -
machineaccount
Use the service account associated with the GCP instance running Ansible. -
application
Use application default credentials associated with the APIs provided by thescopes
parameter.
Automation accounts should not be end user accounts. Removes the temptation to do something interactively as the automation user. API key style creds are strong, unlike garbage human passwords.
Creating an service account is easy. The hard part was validating the roles...