How can I get gs_secret_key and gs_access_key to use gc_storage module in Ansible?

521 views
Skip to first unread message

Augusto M

unread,
Oct 10, 2018, 1:39:14 PM10/10/18
to Ansible Project
I would need to create a directory in a Google Cloud Bucket using Ansible. I would like to know where I can find the values to complete "gs_secret_key" and "gs_access_key" to use "gc_storage" module in Ansible.

- name: Create a bucket with key as directory
  become
: no
  gc_storage
:
    bucket
: "my-bucket-name"
    mode
: "create"
    region
: "US-EAST1"
   
object: "/test_directory/"
    gs_access_key
: "012345678901-com...@developer.gserviceaccount.com"
    gs_secret_key
: "-----BEGIN PRIVATE KEY-----\nMIIblashblah...blahblahmow=\n-----END PRIVATE KEY-----\n"
    gs_access_key
: "e6ablahblah...blahblahfc0"



I'm not sure about the values that I set in the Ansible script. With the current values I get an error message saying:

GSResponseError: 403 Forbidden\nSignatureDoesNotMatchThe request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.PUT\n\n\nWed, 10 Oct 2018 16:26:00 GMT\n/my-bucket-name/

thank you!


Sushena Parthasarathy

unread,
May 15, 2019, 6:55:15 AM5/15/19
to Ansible Project
Hi,
       Issue got fixed ? am getting below error

he full traceback is:
Traceback (most recent call last):
  File "/home/ansible/.ansible/tmp/ansible-tmp-1557917701.18-170733216464166/AnsiballZ_gc_storage.py", line 113, in <module>
    _ansiballz_main()
  File "/home/ansible/.ansible/tmp/ansible-tmp-1557917701.18-170733216464166/AnsiballZ_gc_storage.py", line 105, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/ansible/.ansible/tmp/ansible-tmp-1557917701.18-170733216464166/AnsiballZ_gc_storage.py", line 48, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py", line 491, in <module>
  File "/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py", line 461, in main
  File "/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py", line 344, in handle_put
  File "/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py", line 186, in key_check
AttributeError: 'NoneType' object has no attribute 'get_key'

fatal: [localhost]: FAILED! => {
    "changed": false, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1557917701.18-170733216464166/AnsiballZ_gc_storage.py\", line 113, in <module>\n    _ansiballz_main()\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1557917701.18-170733216464166/AnsiballZ_gc_storage.py\", line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1557917701.18-170733216464166/AnsiballZ_gc_storage.py\", line 48, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py\", line 491, in <module>\n  File \"/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py\", line 461, in main\n  File \"/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py\", line 344, in handle_put\n  File \"/tmp/ansible_gc_storage_payload_kwkWnD/__main__.py\", line 186, in key_check\nAttributeError: 'NoneType' object has no attribute 'get_key'\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 1
}
Reply all
Reply to author
Forward
0 new messages