7

I'm using Itamae with a command like this:

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

The ssh configuration are saved with a name my_ssh_config. Can I use the ssh config name as a argument of itamae ssh?

my ~/.ssh/config

Host my_ssh_config
    HostName xxx.xxx.xxx.xxx
    User ironsand
ironsand
  • 14,329
  • 17
  • 83
  • 176
  • Do you mean using a host alias? ie. in your ssh config, do you have lines like: Host alias1 alias2; HostName xxx.xxx.xxx.xxx, and you want to use -h alias1 instead of -h xxx.xxx.xxx.xxx? – Scott A Nov 21 '15 at 03:07
  • yeah, host alias and user name also. Like when I connect server by `ssh my_ssh_config`. – ironsand Nov 21 '15 at 04:44

1 Answers1

4

As of March 30, support for using ssh config hosts was merged into itamae's master branch:

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

So as long as you are using a recent copy of itamae, this functionality should be supported:

itamae ssh -h my_ssh_config cookbooks/user.rb

or

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

You may also need to specify your key file on the command line using the -i option:

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

or with an IdentityFile stanza in your ssh config:

Host my_ssh_config
    HostName xxx.xxx.xxx.xxx
    User ironsand
    IdentityFile ~/.ssh/my_ssh_host.key
Scott A
  • 7,745
  • 3
  • 33
  • 46