在 vagrant box 中使用 gitfs 为盐后端提供 ssh 凭据
Giving ssh credentials for salt backend with gitfs in vagrant box
我使用 vagrant 来测试我的 salt 配置。在一个盒子上我有一个流浪的盐大师和一个盐仆从,在另一个盒子上我有一个盐仆从。
我正在尝试切换为使用 gitfs 从我的 private 存储库中获取后端。
这是我的 salt.master_config
:
hash_type: sha256
auto_accept: True
roster_file: /srv/salt/roster
fileserver_backend:
- roots
- git
file_roots:
base:
- /srv/salt/environments/base/files
- /srv/salt/environments/base/states
- /srv/salt/users
gitfs_remotes:
- git@github.com:user/repo.git
- pubkey: /srv/salt/environments/base/files/.ssh/id_rsa.pub
- privkey: /srv/salt/environments/base/files/.ssh/id_rsa
- https://github.com/salt/users-formula.git
- https://github.com/salt/openssh-formula.git
其他 gitfs 遥控器过去可以使用,但新的遥控器不接受 ssh 密钥。
当 运行 sudo salt '*' state.apply
我得到:
ERROR ] Error parsing configuration file: /etc/salt/master - mapping values are not allowed here
in "<string>", line 16, column 13:
- pubkey: /srv/salt/environments/base/fi
我也尝试使用来自 vagrantup provisioning 文档 https://www.vagrantup.com/docs/provisioning/salt.html 的 Master Options 并添加 master_pub master_key 到我的 Vagrantfile
:
master.vm.provision :salt do |salt|
salt.install_master = true
salt.master_pub = 'id_rsa.pub'
salt.master_key = 'id_rsa'
salt.install_type = 'stable'
salt.master_config = 'master'
salt.minion_config = 'salt-local'
end
但这是通过 ssh 连接到 vagrant box 而不是真正用于 gitfs。
如何为 vagrant 配置文件提供 ssh 凭据?
找到解决方案:
gitfs_provider: pygit2
gitfs_pubkey: /srv/salt/path/to/files/ssh/id_rsa.pub
gitfs_privkey: /srv/salt/path/to/files/ssh/id_rsa
gitfs_remotes:
- git@github.com:user/repo.git
我使用 vagrant 来测试我的 salt 配置。在一个盒子上我有一个流浪的盐大师和一个盐仆从,在另一个盒子上我有一个盐仆从。
我正在尝试切换为使用 gitfs 从我的 private 存储库中获取后端。
这是我的 salt.master_config
:
hash_type: sha256
auto_accept: True
roster_file: /srv/salt/roster
fileserver_backend:
- roots
- git
file_roots:
base:
- /srv/salt/environments/base/files
- /srv/salt/environments/base/states
- /srv/salt/users
gitfs_remotes:
- git@github.com:user/repo.git
- pubkey: /srv/salt/environments/base/files/.ssh/id_rsa.pub
- privkey: /srv/salt/environments/base/files/.ssh/id_rsa
- https://github.com/salt/users-formula.git
- https://github.com/salt/openssh-formula.git
其他 gitfs 遥控器过去可以使用,但新的遥控器不接受 ssh 密钥。
当 运行 sudo salt '*' state.apply
我得到:
ERROR ] Error parsing configuration file: /etc/salt/master - mapping values are not allowed here
in "<string>", line 16, column 13:
- pubkey: /srv/salt/environments/base/fi
我也尝试使用来自 vagrantup provisioning 文档 https://www.vagrantup.com/docs/provisioning/salt.html 的 Master Options 并添加 master_pub master_key 到我的 Vagrantfile
:
master.vm.provision :salt do |salt|
salt.install_master = true
salt.master_pub = 'id_rsa.pub'
salt.master_key = 'id_rsa'
salt.install_type = 'stable'
salt.master_config = 'master'
salt.minion_config = 'salt-local'
end
但这是通过 ssh 连接到 vagrant box 而不是真正用于 gitfs。
如何为 vagrant 配置文件提供 ssh 凭据?
找到解决方案:
gitfs_provider: pygit2
gitfs_pubkey: /srv/salt/path/to/files/ssh/id_rsa.pub
gitfs_privkey: /srv/salt/path/to/files/ssh/id_rsa
gitfs_remotes:
- git@github.com:user/repo.git