Search code examples
provisioningitamae

Can I use ssh config name when using Itamae


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

Solution

  • 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