【发布时间】:2016-10-25 16:14:52
【问题描述】:
我有以下 vagrantfile
Vagrant.configure(2) do |config|
config.ssh.insert_key = true
config.vm.define "dev" do |app|
app.vm.provider "docker" do |d|
d.image = "allansimon/allan-docker-dev-python"
d.has_ssh = true
end
app.ssh.username = "vagrant"
app.vm.provision "file", source: "~/.ssh/id_rsa", destination: ".ssh/id_rsa"
app.vm.provision "permits-root-to-clone", type: "shell" do |s|
s.inline = "cp /home/vagrant/.ssh/id_rsa /root/.ssh/id_rsa"
end
# if i put here a new shell provisionner , to the exact same repo than in my galaxy roles , it works
app.vm.provision "ansible_local" do |ansible|
ansible.galaxy_role_file = "build_scripts/ansible/requirements.yml"
ansible.playbook = "build_scripts/ansible/bootstrap.yml"
end
end
end
requirements.yml 引用了一些私有的 ansible 角色,它们是 git 克隆的
喜欢这个
- src: git@gitlab.mydomain.com:ansible-roles/myrole.git
scm: git
version: 'master'
name: myrole
我将我的桌面私钥注入到 vagrant 中
- 它在销售供应商中工作
- 如果在我在机器内
vagrant ssh之后它可以工作
但它不适用于 ansible_local 供应商 有错误
==> dev: Running provisioner: ansible_local...
dev: Running ansible-galaxy...
[WARNING]: - supervisord was NOT installed successfully: - command git clone
git@gitlab.mydomain.com:ansible-roles/myrole.git myrole failed in
directory /tmp/tmpQNgCTo (rc=128)
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
有没有办法强制 vagrant 中的 ansible 使用特定的私钥?
【问题讨论】:
标签: git ansible vagrant ssh-keys ansible-galaxy