Coder Social home page Coder Social logo

bridgy's Introduction

bridgy

Image PyPI version (WIP/beta)

TL;DR: bridgy = ssh + tmux + sshfs + cloud inventory search

Just get me to my ec2 box with a simple search. Multiple matches? Just ssh into all matching instances via tmux.

Image

Features:

  • Custom inventory sources:
    • AWS (supports matching by tag, dns, or instance-id)
    • GCP
    • New Relic
    • CSV
    • Ansible inventory
  • Search against multiple inventory sources simultaneously
  • Connect to inventory sources via a bastion/jumpbox
  • Fuzzy search against the inventory
  • Prompt for single/multi selection for matched hosts in inventory
  • Open multiple ssh connections via tmux (splits or tabs)
  • Configure custom tmux layouts (via config)
  • Seamless connection via bastion (via config)
  • Setup sshfs mount to a remote dir
  • Run custom command on login (via config)
  • Run arbitrary ansible playbooks
  • Push / pull files (via ansible fetch/copy task)
  • Ssh tunnel to hosts
  • ECS support (exec to container, currently only via new relic inventory)
  • Python3 support :)

(Want a feature? Just create an issue describing it)

Installing

Linux

pip install --user bridgy

# optionally support sshing into multiple systems at once
sudo apt install tmux

# optionally support remote mounts
sudo apt install sshfs

# put this into your ~/.bashrc (pip install --user does not put bins in the 'right' spot for everyone: https://github.com/pypa/pip/issues/3813)
export PATH=${HOME}/.local/bin:$PATH

Note: you may still need to add bridgy to your path!

OSX

sudo easy_install pip
pip install --user bridgy --ignore-installed six

# optionally support sshing into multiple systems at once
brew install tmux

# optionally support remote mounts
brew cask install osxfuse
brew install sshfs

# put this into your ~/.bash_profile (pip install --user does not put bins in the 'right' spot for everyone: https://github.com/pypa/pip/issues/3813)
export PATH=${HOME}/.local/bin:$PATH

Windows

¯\_(ツ)_/¯

Getting started

After installing, create a configuration file by running

$ bridgy init

This will create a default ~/.bridgy/config.yml file for you. From there you need to configure inventory sources and other options:

config-schema: 2
inventory:
  source:

    - type: csv
      name: on-site servers
      # CSV files are placed in ~/.bridgy/inventory/csv
      file: somefile.csv
      # requires at least name and address
      fields: name, address

    # Inventory parameters to support querying AWS using boto profiles
    - type: aws
      name: test
      profile: a-boto-profile-name
      region: us-west-2


# define ssh behavior and preferences
ssh:
  user: awesome-user
  options: -C -o ServerAliveInterval=255
  command: sudo -i su - another-user -s /bin/bash
  tmux: false

Now you can ssh into a system referenced from the given inventory sources:

# without tmux
$ bridgy ssh someserver

# with tmux (or set the ssh.tmux=true config option to always use tmux)
$ bridgy ssh -t someserver

That's just to get you started, there is plenty more you can do though!

Have a special multi-pane tmux layout for every system you login to? Drop it in the config, reference it by name:

tmux:
  layout:
    logger:
      - cmd: split-window -h
      - cmd: split-window -h
      - cmd: split-window -v
        run: tail -f /var/log/messages
      - cmd: set-window-option synchronize-panes on

then...

$ bridgy ssh -tl logger awesomebox

Want to remotely mount a dir from your ec2 instance over ssh locally?

$ bridgy mount awesomebox:/appdir
[?] What instances would you like to have mounted? (enter to select):
 > o dev-myawesomeboxname                   (10.10.60.220)
   o qa-myawesomeboxname                    (10.10.63.13)

Mounted dev-myawesomeboxname:/tmp at ~/.bridgy/mounts/dev-myawesomeboxname

Need to connect to your boxes via a jumpbox? Drop in your bastion connection information in the config:

bastion:
  user: some-username
  address: some-ip-or-host
  # optional ssh arguments
  options: -C -o ServerAliveInterval=255 -o FingerprintHash=sha256 -o TCPKeepAlive=yes -o ForwardAgent=yes -p 22222

Need a different bastion for a given inventory source, override it:

inventory:
  source:

    - type: csv
      name: on-site servers
      file: anawesome.csv
      fields: name, address
      # if you need to connect to aws hosts via a bastion, then
      # provide all connectivity info in each inventory item
      # (each inventory source bastion overrides the global bastion configuration)
      bastion:
        user: a-better-username
        address: someotherhost.com
        options: -C -o ServerAliveInterval=60

bastion:
  user: some-username
  address: some-ip-or-host.com
  options: -C -o ServerAliveInterval=255 -o FingerprintHash=sha256 -o TCPKeepAlive=yes -o ForwardAgent=yes -p 22222

The same override functionality is available for ssh options and pattern matchers:

inventory:
  source:

    - type: csv
      name: on-site servers
      include_pattern: .*meh_.*
      file: anawesome.csv
      fields: name, address
      ssh:
        user: a-better-username
        options: -C -o ServerAliveInterval=60

ssh:
  user: some-username
  options: -C -o ServerAliveInterval=255

Want to perform arbitrary tasks? Drop an ansible playbook in config, reference it by name (grab-files):

run:
  grab-files:
    - hosts: app-srv-13, dev-srv
      gather_facts: no
      tasks:
        - name: 'Get secrets.yml'
          fetch:
            src: /appdir/config/secrets.yml
            dest: /tmp/prefix-{{ inventory_hostname }}.secrets.yml
            fail_on_missing: yes
            flat: yes
        - name: 'Get production.rb'
          fetch:
            src: /appdir/config/environments/production.rb
            dest: /tmp/prefix-{{ inventory_hostname }}.production.rb
            fail_on_missing: yes
            flat: yes
        - name: 'Get database.yml'
          fetch:
            src: /appdir/config/database.yml
            dest: /tmp/prefix-{{ inventory_hostname }}.database.yml
            fail_on_missing: yes
            flat: yes

then...

$ bridgy run grab-files

PLAY [app-srv-13, dev-srv] *****************************************************

TASK [Get secrets.yml] ********************************************************
ok: [dev-srv]
ok: [app-srv-13]

TASK [Get production.rb] ******************************************************
ok: [dev-srv]
ok: [app-srv-13]

TASK [Get database.yml] *******************************************************
ok: [dev-srv]
ok: [app-srv-13]

$ ls -1 /tmp | grep prefix
prefix-dev-srv.database.yml
prefix-dev-srv.production.rb
prefix-dev-srv.secrets.yml
prefix-app-srv-13.database.yml
prefix-app-srv-13.production.rb
prefix-app-srv-13.secrets.yml

Want to exec into a running container in ECS? (only via new relic inventory is supported)

$ bridgy exec awesome
[?] What containers would you like to exec into? (enter to select):
 > o dev-myawesomecontainer
   o qa-myawesomecontainer

Config Reference

An exhaustive list of options you can put in the config, with some example values:

config-schema: 2
inventory:

  update_at_start: false      # update the inventory sources on each run
  fuzzy_search: true          # allow for more that partial matching, you only need to get 'close'
  exclude_pattern: '.*qa.*'   # exclude instances that match the given regex
  include_pattern: '.*qa.*'   # include only instances that match the given regex

  # in case you need to use this behind a proxy
  http_proxy: http://someurl.com:80 
  https_proxy: http://someurl.com:80 

  source:

    # Example with a CSV
    - type: csv
      name: On-site
      # CSV files are placed in ~/.bridgy/inventory/csv
      file: primary-site.csv
      delimiter: '|'
      # requires at least name and address
      fields: index, name, address, other, random, fields

    - type: aws
      name: Offsite
      # ~/.aws/* configs will be referenced by default, but can be overridden here: 
      access_key_id: AdfhjskfhdkfjfhskfTQ(fake)
      secret_access_key: ZdhfjkshfkjdhfjshfkhfjsE5xx/dhfjksdhfksjf(fake)
      session_token: someawesometoken(fake)
      region: us-west-2

    # Inventory parameters to support querying AWS using boto profiles
    - type: aws
      name: Offsite DR
      profile: offsite-dr-servers
      region: us-west-2

    # All inventory parameters to support querying New Relic
    - type: newrelic
      name: web-production
      account_number: ACCOUNT_NUMBER
      insights_query_api_key: API_KEY

    # You can always use a specific bastion for each inventory source if you want (that overrides the global bastion)
    - type: aws
      name: Offsite DR
      profile: offsite-dr-servers
      region: us-west-2
      # the real bastion!...
      bastion:
        user: jumper
        address: someothersystem.com
        options: -C -o ServerAliveInterval=30 -o TCPKeepAlive=yes

# define ssh behavior and preferences
ssh:
  user: awesome-user
  # Any valid ssh cli options you would specify to SSH (optional)
  options: -C -o ServerAliveInterval=255
  # Run a command upon logging into any host (optional)
  command: sudo -i su - another_user -s /bin/bash
  # Use Tmux to wrap all ssh sessions (optional)
  tmux: true


# This specifies any SSHFS options for mounting remote directories
sshfs:
  # Any sshfs option that you would specify to sshfs (optional)
  # Tip: if you need to be another user on the remote system you can do so via sudo:
  # options: -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server"
  options: -o auto_cache,reconnect,no_readahead -C -o TCPKeepAlive=yes -o ServerAliveInterval=255 -o StrictHostKeyChecking=no

# configure your bastion here if it applies to all of your inventory sources
bastion:
  # User to use when SSHing into the bastion host (optional)
  user: johnybgoode
  # Address of the bastion host
  address: zest
  # Any valid cli options you would specify to SSH (optional)
  options: -C -o ServerAliveInterval=255


tmux:
  # You can make multiple panes to a single host by specifying a layout definition. Simply
  # define each tmux command to run and an optional command to run in that pane.
  # Use these layouts by name with the -l cli option (bridgy ssh -l somename host...)
  layout:
    # bridgy ssh -l example host...
    example:
      - cmd: split-window -h
        #run: sleep 1
      - cmd: split-window -h
        #run: sleep 2
      - cmd: split-window -v
        #run: sleep 3

    logger:
      - cmd: split-window -h
      - cmd: split-window -h
        run: sh -c "cd /webapps; exec sh"
      - cmd: split-window -v
        run: sudo su - -c 'tail -f /webapps/app-*/log/production.log'

# ansible specific configuration (for 'run' profiles)
ansible:
  become_user: root
  become_method: sudo

# an example set of ansible tasks to run against select servers (bridgy run grab-files)
run:
  grab-files:
    - hosts: app-srv-13, dev-srv
      gather_facts: no
      tasks:
        - name: 'Get secrets.yml'
          fetch:
            src: /appdir/config/secrets.yml
            dest: /tmp/prefix-{{ inventory_hostname }}.secrets.yml
            fail_on_missing: yes
            flat: yes

Usage

  bridgy init
  bridgy ssh (-t | --tmux) [-adsuvw] [-l LAYOUT] [-i SOURCE] <host>...
  bridgy ssh [-duv] [-i SOURCE] <host>
  bridgy exec (-t | --tmux) [-adsuvw] [-l LAYOUT] [-i SOURCE] <container>...
  bridgy exec [-duv] [-i SOURCE] <container>
  bridgy list-inventory [-i SOURCE]
  bridgy list-mounts
  bridgy mount [-duv] [-i SOURCE] <host>:<remotedir>
  bridgy unmount [-dv] [-i SOURCE] (-a | <host>...)
  bridgy run <task>
  bridgy update [-v] [-i SOURCE] 
  bridgy (-h | --help)
  bridgy --version

Sub-commands:
  init          create the ~/.bridgy/config.yml
  ssh           ssh into the selected host(s)
  exec          exec into the selected container(s) (new relic + ecs only)
  mount         use sshfs to mount a remote directory to an empty local directory
  unmount       unmount one or more host sshfs mounts
  list-mounts   show all sshfs mounts
  run           execute the given ansible task defined as playbook yml in ~/.bridgy/config.yml
  update        pull the latest inventory from your cloud provider

Options:
  -a        --all            Automatically use all matched hosts.
  -d        --dry-run        Show all commands that you would have run, but don't run them (implies --verbose).
  -i SOURCE --source SOURCE  Search a subset of inventories by name (comma separated for multiple values)
  -l LAYOUT --layout LAYOUT  Use a configured tmux layout for each host.
  -s        --sync-panes     Synchronize input on all visible panes (tmux :setw synchronize-panes on).
  -t        --tmux           Open all ssh connections in a tmux session.
  -u        --update         pull the latest instance inventory from aws then run the specified command.
  -w        --windows        Use tmux windows instead of panes for each matched host.
  -h        --help           Show this screen.
  -v        --verbose        Show debug information.
  --version                  Show version.

Configuration Options are in ~/.bridgy/config.yml

bridgy's People

Contributors

bootswithdefer avatar qinfeng avatar rysi3k avatar timorme avatar wagoodman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bridgy's Issues

show turned off instances with a different color

Currently, bridgy display all available instances, even those that are turned off. It would be neat to display those with a distinctive color to show that connection to them just wont work.

Listing them, even though they are not reachable, is fine imho, because it shows that the listing actually works properly.

Add SSH tunneling

This would at least enable remote debugging.

concept: ssh -L 8080:web-server:80 -L 8443:web-server:443 bastion-host -N
then: curl https://localhost:8443/secure.txt
source: https://solitum.net/an-illustrated-guide-to-ssh-tunnels/

Get only private IPs from AWS

Is it possible to get only Private IPs for AWS Instances?

➜ bridgy ssh aws-env

‣ host01 (ec2-5-14-36-63.compute-1.amazonaws.com)
host02 (ec2-3-17-38-216.compute-1.amazonaws.com)
host03 (10.40.12.34)
host04 (10.32.11.112)

SSH Could be restricted on public IPs

Add ECS integration

Allow the ability to log into the ec2 instance matched by a running task name and actively attach to the docker instance (via exec)

botocore.exceptions.NoRegionError: You must specify a region.

I've just installed bridgy on a new machine (having it working on another), and with the exact same configuration file, I've hit this error upon updating: botocore.exceptions.NoRegionError: You must specify a region.. However, I do specify the region in the config file.

The full output of the bridgy update -v command:

Updating inventory...
Loading variable profile from defaults.
Loading variable config_file from defaults.
Loading variable credentials_file from defaults.
Loading variable data_path from defaults.
Loading variable profile from defaults.
Loading variable region from defaults.
attaching to session: Session(region_name=None)
datapath: /Users/pascaldevink/.bridgy/inventory/aws/production
Loading variable profile from defaults.
Loading variable region from defaults.
Loading variable profile from defaults.
Loading variable ca_bundle from defaults.
Loading variable profile from defaults.
Loading variable api_versions from defaults.
Loading variable profile from defaults.
Loading variable credentials_file from defaults.
Loading variable config_file from defaults.
Loading variable profile from defaults.
Loading variable metadata_service_timeout from defaults.
Loading variable profile from defaults.
Loading variable metadata_service_num_attempts from defaults.
Loading variable profile from defaults.
Looking for credentials via: env
Looking for credentials via: assume-role
Looking for credentials via: shared-credentials-file
Found credentials in shared credentials file: ~/.aws/credentials
Loading JSON file: /Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/data/endpoints.json
Loading variable profile from defaults.
Event choose-service-name: calling handler <function handle_service_name_alias at 0x10cf509d8>
Loading JSON file: /Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/data/ec2/2016-11-15/service-2.json
Event creating-client-class.ec2: calling handler <function add_generate_presigned_url at 0x10cf2a488>
Event creating-client-class.ec2: calling handler <bound method Pill._create_client of <placebo.pill.Pill object at 0x10d3c1d68>>
_create_client
Traceback (most recent call last):
  File "/Users/pascaldevink/.local/bin/bridgy", line 11, in <module>
    sys.exit(main())
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/__main__.py", line 373, in main
    handler(args, config)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/utils.py", line 32, in wrapper
    func(*args,**kwargs)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/__main__.py", line 274, in update_handler
    inventory_obj = inventory.inventory(config)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/utils.py", line 49, in __call__
    return self[args]
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/utils.py", line 51, in __missing__
    ret = self[key] = self.f(*key)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/inventory/__init__.py", line 43, in inventory
    inv = AwsInventory(cache_dir, **srcCfg)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/bridgy/inventory/aws.py", line 41, in __init__
    self.client = session.client('ec2')
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/boto3/session.py", line 263, in client
    aws_session_token=aws_session_token, config=config)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/session.py", line 861, in create_client
    client_config=config, api_version=api_version)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/client.py", line 76, in create_client
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/client.py", line 288, in _get_client_args
    verify, credentials, scoped_config, client_config, endpoint_bridge)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/args.py", line 45, in get_client_args
    endpoint_url, is_secure, scoped_config)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/args.py", line 111, in compute_client_args
    service_name, region_name, endpoint_url, is_secure)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/client.py", line 361, in resolve
    service_name, region_name)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/regions.py", line 122, in construct_endpoint
    partition, service_name, region_name)
  File "/Users/pascaldevink/Library/Python/3.6/lib/python/site-packages/botocore/regions.py", line 135, in _endpoint_for_partition
    raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.

The relevant part of the config file:

config-schema: 2
inventory:
  update_at_start: true
  fuzzy_search: true
  source:
    - type: aws
      name: production
      region: eu-west-1

and of course I have a ~/.aws/credentials file with the correct access key and secret.

Any clue what might cause this? Could it be a version thing of a dependency maybe?

bridgy init got erro: sample yaml file not found

'''
Traceback (most recent call last):
File "/home/hhhhh/.local/bin/bridgy", line 11, in
sys.exit(main())
File "/home/hhhhh/.local/lib/python3.6/site-packages/bridgy/main.py", line 340, in main
init_handler(args, config)
File "/home/hhhhh/.local/lib/python3.6/site-packages/bridgy/utils.py", line 32, in wrapper
func(*args,**kwargs)
File "/home/hhhhh/.local/lib/python3.6/site-packages/bridgy/main.py", line 312, in init_handler
if config.create():
File "/home/hhhhh/.local/lib/python3.6/site-packages/bridgy/config/base.py", line 89, in create
fh.write(self.config_template_contents)
File "/home/hhhhh/.local/lib/python3.6/site-packages/bridgy/config/base.py", line 64, in config_template_contents
return pkgutil.get_data('bridgy', 'config/samples/' + self.config_template_path)
File "/usr/lib/python3.6/pkgutil.py", line 634, in get_data
return loader.get_data(resource_name)
File "", line 832, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/home/hhhhh/.local/lib/python3.6/site-packages/bridgy/config/samples/sample_config_2.yml'
'''

Support a ECS backend

It would be ideal to be able to exec into an ECS task (container) and keep and inventory that is searchable by ECS service name.

Tmux error is not well handled which throws TypeError: a bytes-like object is required, not 'str'

Tmux error is not well handled which cause bridgy tmux session not open.

env:
macOS 10.13 + python3.6.5

bridgy config:

 tmux:
   layout:
       logger:
           - cmd: split-window -h
           - cmd: split-window -h
           - cmd: split-window -h
             run: tail -f /var/log/syslog
           - cmd: set-window-option synchronize-panes on

bridgy command:

bridgy ssh -tl logger core -I mysource

error:

Traceback (most recent call last):
  File "/Users/qinfeng/.local/share/virtualenvs/bridgy-5NqTP_ZY/bin/bridgy", line 11, in <module>
    load_entry_point('bridgy', 'console_scripts', 'bridgy')()
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/__main__.py", line 425, in main
    handler(args, config)
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/utils.py", line 34, in wrapper
    func(*args,**kwargs)
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/__main__.py", line 218, in ssh_handler
    tmux.run(config, commands, args['-w'], layout, args['-d'], args['-s'])
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/tmux.py", line 20, in run
    with TmuxSession(commands=commands, in_windows=in_windows, layout_cmds=layout_cmds, dry_run=dry_run, sync=sync) as tmux:
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/tmux.py", line 58, in __enter__
    self.tmux(*cmd)
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/tmux.py", line 118, in tmux
    repr(std_err.strip("\n").replace("\n",', ')),
TypeError: a bytes-like object is required, not 'str'

It looks like std_err returned by python subprocess pipe is in bytes type which needs to be decoded to str obj

Extend CSV inventory to support per-instance configurations

As hinted to in #9 (comment) , it would be great to be able to map arbitrary CSV columns to instance parameters that override the global or inventory ssh configuration. For example, a CSV inventory with extra columns:

name, address, user, ssh-key
server-1, 123.87.123.223, admin, id_rsa.ss1
awesome-server-2, 22.54.21.123, frank, id_dsa.key42

Bridgy could take advantage of the extra information like so:

inventory:
  source:
    - type: csv
      name: on-site servers
      file: somefile.csv
      fields: name, address, user, ssh_key
      ssh:
        user: fields['user']
        options: -i fields['ssh_key']

The yaml format needs more thought, but that's the general idea (I'm open to suggestions).

Support a Google Cloud backend

This issue should get broken down into smaller issues as it gets picked up. However, it would be great to get basic inventory support for GCP Compute Engine, followed by GKE when the #31 has been implemented.

Provide option to search instance within ONE source

I have multiple servers within multiple AWS account therefore I will have multiple AWS source for servers.

It will be much faster and better if there is an option to narrow down instance searching within ONE source.

Cannot list-inventory if any are shutdown

It looks like bridgy relies on PrivateIpAddress being set, which is not always the case for every instance:

https://github.com/wagoodman/bridgy/blob/master/bridgy/inventory/aws.py#L60

Some of my instances return a state of:

"State": {
"Code": 48,
"Name": "terminated"
}

And instances of this type do not have a field of PrivateIpAddress, causing the following error when trying to list the inventory:

Traceback (most recent call last):
  File "/home/torme/.local/bin/bridgy", line 11, in <module>
    sys.exit(main())
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/__main__.py", line 356, in main
    handler(args, config)
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/utils.py", line 31, in wrapper
    func(*args,**kwargs)
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/__main__.py", line 258, in list_inventory_handler
    for ip, name, aliases, source in inventory.instances(config):
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/utils.py", line 45, in __call__
    return self[args]
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/utils.py", line 47, in __missing__
    ret = self[key] = self.f(*key)
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/inventory/__init__.py", line 105, in instances
    all_instances = inventory(config).instances()
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/inventory/source.py", line 88, in instances
    instances.extend(inventory.instances())
  File "/home/torme/.local/lib/python2.7/site-packages/bridgy/inventory/aws.py", line 60, in instances
    elif instance['PrivateIpAddress']:
KeyError: 'PrivateIpAddress'

Support for clusterssh

Feature Request
Ability to use/enable clusterssh when SSH'ing to multiple servers so you can run the same command on all servers at once.

Enhancements

Git integration?
Branch deploy or sync.
Mount local sync? Remote mount changes are synced to a local git repo.
Git bare set working tree to remote mount.
Rsync?

Invert tmux logic

--no-tmux should really be --tmux and the default behavior should be to not use tmux unless configured to do so with:

...
ssh:
    tmux: true

Import inventory from ~/.ssh/config

After isntallation I do $ bridgy ssh my-server-alias
And getting error No inventory source specified (~/.bridgy/config.yml):

I already have all my servers aliased in ~/.ssh/config:

Host  my-server-alias
    HostName my-server.my-doamin.com     #ip could be here
    IdentityFile ~/.ssh/my_key_rsa
    User ubuntu
    ForwardAgent yes

That's basiuc config taht let's me use ssh my-server-alias to login correct IP with correct RSA key.

Would be nice to be able to reuse ssh settings for brigy features

Attach to existing remote sessions

It would be nice to have something that acted like ssh ... -t tmux attach-session or ssh ... -t -- bash -c "tmux attach || tmux new" to attach or create a session. Currently bridgy does:

(TMUX on my local machine)
 |
 + session 1: someotherhost
    \_ window1: ssh user@someotherhost
    \_ window2: ssh user@someotherhost
    \_ ...

but attaching or creating would allow:

(TMUX on my local machine)
 |
 + session 1 linked to an existing session on someotherhost
    \_ window1: shell on someotherhost
    \_ window2: shell on someotherhost
    \_ ...

Note: this needs to be resilient to tmux not being installed on the remote host.

Add filter to only allow some systems to be shown

Sometimes there are a set of systems in an inventory that you don't want to be able to log into (e.g. production). It would be nice to have a pattern-like configuration item that would allow for system inventory inclusion and exclusion rules.

Support multiple sources

Would be very useful to combine multiple sources of inventory. For example we have multiple AWS accounts and an on-premise environment.

Override the ssh user via cli

Though there is a configured user, it would be nice to override the user on cli via the <user>@<host> approach that all ssh-like tools support

Support Bastion Host Per Source

It would ideal to have the ability to assign a bastion host to a source or sources to a bastion.

In my case, I have multiple AWS profiles, i.e. Dev, QA, Prod, Ops, but different bastion hosts for each.

Updating AWS inventory doesn't show changes to instances

When you change the Name tag (or and instance gets a new IP, etc) of an AWS instance and run bridgy update, subsequent commands do not see the updated information. Removing the cache files in ~/.bridgy/inventory/aws/profile/* and running an update causes the correct information to be used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.