Cannot find google secret manager module in ansible

I am trying to Write some data to the GCP Secret manager using my account which is already authenticated. I am using this playbook.

  • name: Add secret to Google Cloud Secret Manager
    hosts: localhost
    gather_facts: no
    tasks:
    • name: Set secret value
      set_fact:
      secret_value: “my-secret-value”

    • name: Add secret version
      google.cloud.gcp_secret_manager_secret_version:
      name: “projects/{{ gcp_project }}/secrets/{{ secret_name }}”
      data: “{{ secret_value }}”
      state: present
      delegate_to: localhost

However this is not able to locate the module google.cloud.gcp_secret_manager_secret_version. I cannot find any module related to secrets in cloud.google.

ERROR! couldn’t resolve module/action ‘google.cloud.gcp_secret_manager_secret_version’. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in ‘/home/ansible/win-playbooks/win_ad/secretmain.yml’: line 10, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

Is this what you are looking for?

This is written in Go. I am using python modules under ansible collection. Do you have something in python?

Try searching GitHub? That’s what I did, it isn’t something I’ve used.

There doesn’t seem to be anything matching gcp_secret_manager_secret_version on Ansible Galaxy.

What is the source of the playbook you are using?

I don’t think there’s such a module in google.cloud. At least, I don’t see one in the list of modules.

There’s a PR about a gcp_secret_manager module which might be what you’re looking for, but it’s not merged yet.

1 Like