Skip to main content

Wikimedia ssh wrapper to expand host names

Project description

wm-ssh

Ssh wrapper to expand wikimedia hostnames.

Currently it will try several sources, heavily using caches:

Installation

pip

Just pip install wm-ssh, that should bring in a new binary, wm-ssh.

Configuration

You can change the default settings by creating a configuration file, and passing the path using --config-file or using the default ~/.config/wm-ssh/config.json.

You can se an example of the loaded configuration running:

wm-ssh -v --print-config

Known hosts url

This is a url with an ssh known hosts formatted file (see man for sshd(8) for the format), the default one will use wikimedia bare metal hosts and non-cloud VMs.

Openstack browser

Url to the openstack browser toolforge tool, with the list of all the VMs, the default will use the current available one.

Netbox

NOTE: The netbox feature needs you to have a token for netbox.wikimedia.org, see: https://netbox.wikimedia.org/user/api-tokens/

You can either configure the netbox cli and set just the path to the config file (the default is ~/.config/netbox/config.json), or you can set the netbox token and url directly in the wm-ssh config like (~/.config/wm-ssh/config.json):

{
    "netbox_config": {
        "netbox_url": "https://netbox.wikimedia.org/api",
        "api_token": "myapitokenwouldgohere"
    }
}

Running from code

Note that this mode will require some tweaks in the auto-completing for it to work.

Clone the code:

git clone git@github.com:david-caro/wm-ssh.git

Install dependencies with poetry:

poetry install

Run with poetry:

poetry run wm-ssh <MYHOST>

Bash completion

You can use the utils/wm-ssh.complete file (source it from your bashrc for example) to achieve bash completion features, though they only work with wmcs openstack instances and known hosts.

For example, add in your ~/.bashrc file:

source /path/to/git/repo/utirs/wm-ssh.complete

After that, it will autocomplete host names from the caches:

08:04 PM ~/Work/repos/per_user/david-caro/wm-ssh  (main|✚ 2)
dcaro@vulcanus$ wm-ssh an<tab><tab>

Display all 127 possibilities? (y or n)<y>

an-airflow1001.eqiad.wmnet                       an-presto1004.eqiad.wmnet                        an-worker1101.eqiad.wmnet
an-airflow1002.eqiad.wmnet                       an-presto1005.eqiad.wmnet                        an-worker1102.eqiad.wmnet
an-airflow1003.eqiad.wmnet                       an-test-client1001.eqiad.wmnet                   an-worker1103.eqiad.wmnet
analytics1058.eqiad.wmnet                        an-test-coord1001.eqiad.wmnet                    an-worker1104.eqiad.wmnet
analytics1059.eqiad.wmnet                        an-test-coord1002.eqiad.wmnet                    an-worker1105.eqiad.wmnet
analytics1060.eqiad.wmnet                        an-test-druid1001.eqiad.wmnet                    an-worker1106.eqiad.wmnet
analytics1061.eqiad.wmnet                        an-test-master1001.eqiad.wmnet                   an-worker1107.eqiad.wmnet
analytics1062.eqiad.wmnet                        an-test-master1002.eqiad.wmnet                   an-worker1108.eqiad.wmnet
analytics1063.eqiad.wmnet                        an-test-presto1001.eqiad.wmnet                   an-worker1109.eqiad.wmnet
analytics1064.eqiad.wmnet                        an-test-ui1001.eqiad.wmnet                       an-worker1110.eqiad.wmnet
analytics1065.eqiad.wmnet                        an-test-worker1001.eqiad.wmnet                   an-worker1111.eqiad.wmnet
analytics1066.eqiad.wmnet                        an-test-worker1002.eqiad.wmnet                   an-worker1112.eqiad.wmnet
analytics1067.eqiad.wmnet                        an-test-worker1003.eqiad.wmnet                   an-worker1113.eqiad.wmnet
analytics1068.eqiad.wmnet                        an-tool1005.eqiad.wmnet                          an-worker1114.eqiad.wmnet
analytics1069.eqiad.wmnet                        an-tool1007.eqiad.wmnet                          an-worker1115.eqiad.wmnet
analytics1070.eqiad.wmnet                        an-tool1008.eqiad.wmnet                          an-worker1116.eqiad.wmnet
analytics1071.eqiad.wmnet                        an-tool1009.eqiad.wmnet                          an-worker1117.eqiad.wmnet
analytics1072.eqiad.wmnet                        an-tool1010.eqiad.wmnet                          an-worker1118.eqiad.wmnet
analytics1073.eqiad.wmnet                        an-tool1011.eqiad.wmnet                          an-worker1119.eqiad.wmnet
analytics1074.eqiad.wmnet                        an-web1001.eqiad.wmnet                           an-worker1120.eqiad.wmnet
analytics1075.eqiad.wmnet                        an-worker1078.eqiad.wmnet                        an-worker1121.eqiad.wmnet
analytics1076.eqiad.wmnet                        an-worker1079.eqiad.wmnet                        an-worker1122.eqiad.wmnet
analytics1077.eqiad.wmnet                        an-worker1080.eqiad.wmnet                        an-worker1123.eqiad.wmnet
an-conf1001.eqiad.wmnet                          an-worker1081.eqiad.wmnet                        an-worker1124.eqiad.wmnet
an-conf1002.eqiad.wmnet                          an-worker1082.eqiad.wmnet                        an-worker1125.eqiad.wmnet
an-conf1003.eqiad.wmnet                          an-worker1083.eqiad.wmnet                        an-worker1126.eqiad.wmnet
an-coord1001.eqiad.wmnet                         an-worker1084.eqiad.wmnet                        an-worker1127.eqiad.wmnet
an-coord1002.eqiad.wmnet                         an-worker1085.eqiad.wmnet                        an-worker1128.eqiad.wmnet
an-db1001.eqiad.wmnet                            an-worker1086.eqiad.wmnet                        an-worker1129.eqiad.wmnet
an-db1002.eqiad.wmnet                            an-worker1087.eqiad.wmnet                        an-worker1130.eqiad.wmnet
an-db-backup-1.analytics.eqiad1.wikimedia.cloud  an-worker1088.eqiad.wmnet                        an-worker1131.eqiad.wmnet
andrewtest2.trove.eqiad1.wikimedia.cloud         an-worker1089.eqiad.wmnet                        an-worker1132.eqiad.wmnet
an-druid1001.eqiad.wmnet                         an-worker1090.eqiad.wmnet                        an-worker1133.eqiad.wmnet
an-druid1002.eqiad.wmnet                         an-worker1091.eqiad.wmnet                        an-worker1134.eqiad.wmnet
an-druid1003.eqiad.wmnet                         an-worker1092.eqiad.wmnet                        an-worker1135.eqiad.wmnet
an-druid1004.eqiad.wmnet                         an-worker1093.eqiad.wmnet                        an-worker1136.eqiad.wmnet
an-druid1005.eqiad.wmnet                         an-worker1094.eqiad.wmnet                        an-worker1137.eqiad.wmnet
an-launcher1002.eqiad.wmnet                      an-worker1095.eqiad.wmnet                        an-worker1138.eqiad.wmnet
an-master1001.eqiad.wmnet                        an-worker1096.eqiad.wmnet                        an-worker1139.eqiad.wmnet
an-master1002.eqiad.wmnet                        an-worker1097.eqiad.wmnet                        an-worker1140.eqiad.wmnet
an-presto1001.eqiad.wmnet                        an-worker1098.eqiad.wmnet                        an-worker1141.eqiad.wmnet
an-presto1002.eqiad.wmnet                        an-worker1099.eqiad.wmnet
an-presto1003.eqiad.wmnet                        an-worker1100.eqiad.wmnet

08:04 PM ~/Work/repos/per_user/david-caro/wm-ssh  (main|✚ 2)
dcaro@vulcanus$ wm-ssh an

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wm-ssh-0.3.4.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

wm_ssh-0.3.4-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file wm-ssh-0.3.4.tar.gz.

File metadata

  • Download URL: wm-ssh-0.3.4.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for wm-ssh-0.3.4.tar.gz
Algorithm Hash digest
SHA256 d5eb381f84754ba29f7a2edec8384e5a2ecd103ecb6af48af82abef1f18d8f0e
MD5 14126b6e5fc6ec1e84c511a20bd33482
BLAKE2b-256 85019d18bfc1f27237054621575b59982530da8303f9f2bb02cd7efef372fa31

See more details on using hashes here.

File details

Details for the file wm_ssh-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: wm_ssh-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for wm_ssh-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b8cd48265682b34f47e685ce165c43a8d51f0da13405d919c6aaed6a351d2eff
MD5 8c507f79efbdb3a5738f64c5f829d30b
BLAKE2b-256 c296aedf6340ec1e9cc6b16ee1e8178dca739d136eb56918dfa67897685793e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page