I am trying to create a subscription for google pubsub through ansible
playbook.
 this is my task.
- name: create a subscription

  gcpubsub:
    topic: test-topic1
    state: present
    credentials_file: "{{ gcp_cred_file }}"
    project_id: "{{ gcp_project }}"


Now it does not seem to work,i have installed google-cloud-pubsub

getting this error regarding client.

Any help how can i debug this?

Here is the error.

The full traceback is:
Traceback (most recent call last):
  File 
"/home/rashmi/.ansible/tmp/ansible-tmp-1599709674.061256-7651-29288875173708/AnsiballZ_gcpubsub.py",
line 102, in <module>
    _ansiballz_main()
  File 
"/home/rashmi/.ansible/tmp/ansible-tmp-1599709674.061256-7651-29288875173708/AnsiballZ_gcpubsub.py",
line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File 
"/home/rashmi/.ansible/tmp/ansible-tmp-1599709674.061256-7651-29288875173708/AnsiballZ_gcpubsub.py",
line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.cloud.google.gcpubsub',
init_globals=None, run_name='__main__', alter_sys=True)
  File "/home/rashmi/anaconda3/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/home/rashmi/anaconda3/lib/python3.7/runpy.py", line 96, in
_run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/rashmi/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File 
"/tmp/ansible_gcpubsub_payload_soisvl0x/ansible_gcpubsub_payload.zip/ansible/modules/cloud/google/gcpubsub.py",
line 333, in <module>
  File 
"/tmp/ansible_gcpubsub_payload_soisvl0x/ansible_gcpubsub_payload.zip/ansible/modules/cloud/google/gcpubsub.py",
line 265, in main
AttributeError: module 'google.cloud.pubsub' has no attribute 'Client'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File
\"/home/rashmi/.ansible/tmp/ansible-tmp-1599709674.061256-7651-29288875173708/AnsiballZ_gcpubsub.py\",
line 102, in <module>\n    _ansiballz_main()\n  File
\"/home/rashmi/.ansible/tmp/ansible-tmp-1599709674.061256-7651-29288875173708/AnsiballZ_gcpubsub.py\",
line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path,
ANSIBALLZ_PARAMS)\n  File
\"/home/rashmi/.ansible/tmp/ansible-tmp-1599709674.061256-7651-29288875173708/AnsiballZ_gcpubsub.py\",
line 40, in invoke_module\n
runpy.run_module(mod_name='ansible.modules.cloud.google.gcpubsub',
init_globals=None, run_name='__main__', alter_sys=True)\n  File
\"/home/rashmi/anaconda3/lib/python3.7/runpy.py\", line 205, in
run_module\n    return _run_module_code(code, init_globals, run_name,
mod_spec)\n  File \"/home/rashmi/anaconda3/lib/python3.7/runpy.py\",
line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name,
script_name)\n  File
\"/home/rashmi/anaconda3/lib/python3.7/runpy.py\", line 85, in
_run_code\n    exec(code, run_globals)\n  File
\"/tmp/ansible_gcpubsub_payload_soisvl0x/ansible_gcpubsub_payload.zip/ansible/modules/cloud/google/gcpubsub.py\",
line 333, in <module>\n  File
\"/tmp/ansible_gcpubsub_payload_soisvl0x/ansible_gcpubsub_payload.zip/ansible/modules/cloud/google/gcpubsub.py\",
line 265, in main\nAttributeError: module 'google.cloud.pubsub' has no
attribute 'Client'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

PLAY RECAP 
********************************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0
failed=1    skipped=0    rescued=0    ignored=0

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAJ4U50WrcdL4OHQCi5OqunFDYK_b%2B%2B71e4dcQpgrnTexjDiFTw%40mail.gmail.com.

Reply via email to