问题
I am trying to write a module in which puppet will be fetching an SVN repo and i want it to use a specific key in order to fetch the repository. How can I specify a ssh key to in SVN VCSrepo?
On the documentation it says we can use vcsrepo for managing ssh keys but there isn't any example for SVN on how to do it at their website
回答1:
Well, it's a little confusing, to be sure. The documentation states
When your source uses SSH, such as 'username@server:…', you can manage your SSH keys with Puppet using the require metaparameter in vcsrepo to ensure they are present.
This implies that you manage the key through an independent resource, e.g.
file { '/home/svn-user/.ssh/id_rsa': ... }
As to your question, the documentation doesn't look very promising, sadly:
- there is a
ssh_identity
feature, but it is only present for thegit
andhg
providers - for those providers, you can use the
identity
parameter to specify your key
I'm not sure about the reasoning behind excluding svn
from this feature. This seems like a valid question to the puppet-dev mailing list or the #puppet-dev
IRC channel on Freenode.
回答2:
It can be done but it requires stepping outside of Puppet and configuring the Subversion client with a custom tunnel protocol. Basically, in ~/.subversion/config
put something like this:
[tunnels]
ssh_user_<remote_user> = $SVN_SSH ssh -q -l <remote_user> -o IdentityFile=<ssh_identity_file>
I wrote about how to do it on my site.
来源:https://stackoverflow.com/questions/25270285/vcsrepo-specifying-ssh-key-to-use