Commit 03e07d4e by e0d

adding friendly names

parent f98ad043
...@@ -25,8 +25,8 @@ JUMPBOX_CONFIG = """ ...@@ -25,8 +25,8 @@ JUMPBOX_CONFIG = """
User {user} User {user}
""" """
HOS_CONFIG = """ HOST_CONFIG = """
Host {ip} Host {name}
ProxyCommand ssh -W %h:%p {jump_box} ProxyCommand ssh -W %h:%p {jump_box}
HostName {ip} HostName {ip}
IdentityFile {identity_file} IdentityFile {identity_file}
...@@ -48,8 +48,8 @@ def _ssh_config(args): ...@@ -48,8 +48,8 @@ def _ssh_config(args):
user = args.get("<user>",DEFAULT_USER) user = args.get("<user>",DEFAULT_USER)
vpc_id = args.get("<vpc_id>") vpc_id = args.get("<vpc_id>")
jump_box = "{vpc_id}-jumpbox".format(vpc_id=vpc_id) jump_box = "{vpc_id}-jumpbox".format(vpc_id=vpc_id)
friendly = "{vpc_id}-{logical_id}-{instance_id}"
reservations = vpc.get_all_instances(filters={'vpc-id' : vpc_id}) reservations = vpc.get_all_instances(filters={'vpc-id' : vpc_id})
...@@ -67,7 +67,8 @@ def _ssh_config(args): ...@@ -67,7 +67,8 @@ def _ssh_config(args):
identity_file=identity_file) identity_file=identity_file)
else: else:
print HOS_CONFIG.format( print HOST_CONFIG.format(
name=instance.private_ip_address,
vpc_id=vpc_id, vpc_id=vpc_id,
jump_box=jump_box, jump_box=jump_box,
ip=instance.private_ip_address, ip=instance.private_ip_address,
...@@ -76,7 +77,11 @@ def _ssh_config(args): ...@@ -76,7 +77,11 @@ def _ssh_config(args):
identity_file=identity_file) identity_file=identity_file)
#duplicating for convenience with ansible #duplicating for convenience with ansible
print HOS_CONFIG.format( name = friendly.format(vpc_id=vpc_id,
logical_id=logical_id,
instance_id=instance.id)
print HOST_CONFIG.format(
name=name,
vpc_id=vpc_id, vpc_id=vpc_id,
jump_box=jump_box, jump_box=jump_box,
ip=instance.private_ip_address, ip=instance.private_ip_address,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment