# Molecule GCE plugin - use existing private key

**URL:** <https://forum.ansible.com/t/molecule-gce-plugin-use-existing-private-key/3461>\
**Category:** Get Help\
**Tags:** molecule\
**Created:** [January 24, 2024, 4:04pm UTC](https://forum.ansible.com/t/molecule-gce-plugin-use-existing-private-key/3461 "2024-01-24T16:04:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [January 24, 2024, 4:04pm UTC](https://forum.ansible.com/t/molecule-gce-plugin-use-existing-private-key/3461/1 "2024-01-24T16:04:53Z")

</div>

I want to set the SSH private key that Molecule GCE plugin uses.

Even though at [molecule-gce/src/molecule\_gce/driver.py at main · ansible-community/molecule-gce · GitHub](https://github.com/ansible-community/molecule-gce/blob/main/src/molecule_gce/driver.py#L36) states “This driver assumes the developer has deployed project wide ssh key”. However at [molecule-gce/src/molecule\_gce/playbooks/tasks/create\_linux\_instance.yml at main · ansible-community/molecule-gce · GitHub](https://github.com/ansible-community/molecule-gce/blob/main/src/molecule_gce/playbooks/tasks/create_linux_instance.yml#L2) a new SSH key is created and written to `"{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"`.

How can I provide the path to the SSH private key and username that Molecule should use?

If I add something like the following to `molecule.yml`, then run `molecule create && molecule converge` , SSH authentication using the provided keyfile works. However with `molecule test`, SSH authentication fails.

```auto
provisioner:
  connection_options:
    ansible_ssh_common_args: '-J jumphost'
    ansible_private_key_file: /host-home-folder/.ssh/id_rsa_jenkins
    ansible_user: jenkins

```

---

<div class="post-metadata">

**Author:** ![cnfrancis](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/cnfrancis/32/2615_2.png) [@cnfrancis](https://forum.ansible.com/u/cnfrancis)\
**Post date:** [August 7, 2024, 9:25pm UTC](https://forum.ansible.com/t/molecule-gce-plugin-use-existing-private-key/3461/2 "2024-08-07T21:25:22Z")

</div>

were you able to figure a workaround? i’m encountering the same issue

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [August 12, 2024, 5:58am UTC](https://forum.ansible.com/t/molecule-gce-plugin-use-existing-private-key/3461/3 "2024-08-12T05:58:55Z")

</div>

I didn’t find one that worked in my environment.
