You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 at the converge stage with an error that shows that the correct
Also when I execute molecule login I'm presented with a password prompt for the wrong user ('root' the user in the terminal where 'molecule' is executed.).
In instance_config.yml in ~/.cache/molecule/<role name>/<scenario name>, "user" is "root" and "identity_file" is "/root/.cache/molecule/groups/default/ssh_key" rather than the desired one "/root/.ssh/jenkins_private_key". If replace manually the values of "user" & "identity_file" to my custom ones, molecule login works.
I see that the file instance_config.yml is created by a handler in GCE plugin with the value of "user" being that of the env var USER and "identity_file" being "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key". How can I influence these values while using the GCE driver?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to set the SSH private key that Molecule GCE plugin uses.
Even though at 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 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 runmolecule create && molecule converge
, SSH authentication using the provided keyfile works. However withmolecule test
, SSH authentication fails at the converge stage with an error that shows that the correctAlso when I execute
molecule login
I'm presented with a password prompt for the wrong user ('root' the user in the terminal where 'molecule' is executed.).I have added that below to
molecule.yml
.In
instance_config.yml
in~/.cache/molecule/<role name>/<scenario name>
, "user" is "root" and "identity_file" is "/root/.cache/molecule/groups/default/ssh_key" rather than the desired one "/root/.ssh/jenkins_private_key". If replace manually the values of "user" & "identity_file" to my custom ones,molecule login
works.I see that the file
instance_config.yml
is created by a handler in GCE plugin with the value of "user" being that of the env varUSER
and "identity_file" being"{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/ssh_key"
. How can I influence these values while using the GCE driver?Beta Was this translation helpful? Give feedback.
All reactions