Sha256: 60706dcae0476f01f82de43b2e2383d9c947a6bba70f8e3c8986cb7fa285748d
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module EY class Metadata module SshAliasHelper # Aliases like 'my_env-app_master' or 'my_env-utilities-5' that go in .ssh/config # # For example: # Host my_env-app_master # Hostname ec2-111-111-111-111.compute-1.amazonaws.com # User deploy # StrictHostKeyChecking no def ssh_aliases counter = Hash.new 0 %w{ app_master db_master db_slaves app_slaves utilities }.map do |role_group| send(role_group).map do |public_hostname| ssh_alias counter, role_group, public_hostname end end.flatten.join("\n") end # Used internally to generate a single ssh alias. def ssh_alias(counter, role_group, public_hostname) id = case role_group when 'db_slaves', 'app_slaves', 'utilities' "#{role_group}-#{counter[role_group] += 1}" else role_group end %{Host #{environment_name}-#{id} Hostname #{public_hostname} User #{ssh_username} StrictHostKeyChecking no } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems