【问题标题】:Can I use ssh config name when using Itamae使用 Itamae 时可以使用 ssh 配置名称吗
【发布时间】:2015-11-12 13:47:31
【问题描述】:

我正在使用 Itamae 和这样的命令:

itamae ssh -u ironsand -h xxx.xxx.xxx.xxx cookbooks/user.rb

ssh 配置以名称my_ssh_config 保存。 我可以使用 ssh 配置名称作为 itamae ssh 的参数吗?

我的~/.ssh/config

Host my_ssh_config
    HostName xxx.xxx.xxx.xxx
    User ironsand

【问题讨论】:

  • 您的意思是使用主机别名吗? IE。在您的 ssh 配置中,您是否有类似以下内容的行: Host alias1 alias2;主机名 xxx.xxx.xxx.xxx,你想用 -h alias1 代替 -h xxx.xxx.xxx.xxx?
  • 是的,还有主机别名和用户名。就像我通过ssh my_ssh_config 连接服务器时一样。

标签: provisioning itamae


【解决方案1】:

截至 3 月 30 日,对使用 ssh 配置主机的支持已合并到 itamae 的 master 分支:

https://github.com/itamae-kitchen/itamae/pull/115

因此,只要您使用的是最新的 itamae 副本,就应该支持此功能:

itamae ssh -h my_ssh_config cookbooks/user.rb

itamae ssh --host=my_ssh_config cookbooks/user.rb

您可能还需要在命令行中使用-i 选项指定您的密钥文件:

itamae ssh --host=my_ssh_config -i ~/.ssh/my_ssh_host.key cookbooks/user.rb

或在您的 ssh 配置中使用 IdentityFile 节:

Host my_ssh_config
    HostName xxx.xxx.xxx.xxx
    User ironsand
    IdentityFile ~/.ssh/my_ssh_host.key

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-16
    • 2010-11-24
    • 2014-10-06
    • 1970-01-01
    • 2018-08-22
    • 2015-07-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多