Je ne peux pas forcer le provisionnement errant à cloner des repos git privés à partir de bitbucket. J'ai vagabond 1.6.3.Le shell Vagrant et le provisionnement ansible échouent avec le bitbucket
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
config.ssh.forward_agent = true
config.vm.define "abox" do |abox|
abox.vm.box = "ubuntu/trusty32"
abox.vm.hostname = "abox"
abox.ssh.forward_agent = true
abox.vm.network "private_network", ip: "192.168.50.4"
abox.vm.network "forwarded_port", guest: 22, host: 2233
abox.vm.network "forwarded_port", guest: 6340, host: 6340
abox.vm.network "forwarded_port", guest: 8080, host: 6388
abox.vm.provision :shell,
:path => "provisioning/ssh_keys.sh", :privileged => false
abox.vm.provision :shell,
:path => "provisioning/setup_project.sh"
end
end
Où dans ssh_keys J'ai:
function create_key() {
ssh-add -L >> ~/.ssh/authorized_keys
ssh-keyscan -t rsa 127.0.0.1 > ~/.ssh/known_hosts
}
create_key
Puis, en setup_project j'appelle:
su - vagrant -c "ssh-keyscan bitbucket.org >> /home/vagrant/.ssh/known_hosts && \
ssh-keyscan github.com >> /home/vagrant/.ssh/known_hosts"
echo 'Clone bitbucket repo'
su - vagrant -c "cd /vagrant && git clone [email protected]:someuser/some-project-that-i-have-access-to.git"
La sortie est:
Permission denied (publickey).
==> abox: fatal: Could not read from remote repository.
==> abox:
==> abox: Please make sure you have the correct access rights
==> abox: and the repository exists.
Error: Error while executing git clone -q [email protected]:someuser/some-project-that-i-have-access-to.git localclone
Cependant quand je vagrant ssh
dans la boîte et th et appelez la même commande git clone maually - tout fonctionne. J'ai aussi testé la configuration de l'Ansible mais le problème était exactement le même.
Quel est le problème ici?
Pouvez-vous expliquer c'est un peu plus? Ce que je l'ai fait était de: 1. supprimer 'su - errante -c "commande"' 'et ne laisser que commande' 2. Exécutez la' setup_project' avec: = PRIVILÉGIÉ> false Maintenant, il fonctionne. Je suppose que le problème ici est lié au fait que j'ai d'abord lancé setup_project en tant que root et 'su' à l'utilisateur' vagagrant'. – eXt