kyl
kyl

Reputation: 579

Softlayer SLCLI server list by pattern

I want to query my list of servers, but only return servers that match a pattern; reason for this is I want to contact a specific set of servers, for example: server_apisX, and server_uiX.

I tried slcli vs list -H myhostprefix but it only matches exact matches.

Thanks

Upvotes: 0

Views: 234

Answers (2)

mcruz
mcruz

Reputation: 1532

Complementing the previous answer …

Please, try the following examples:

Hostname to test: “myhostname-vsi-test

  • Contains part of the hostname:

    slcli vs list –H “*=vsi”

  • Begins with:

    slcli vs lsit –H “^= myhost”

  • Ends with:

    slcli vs lsit –H “$= test”

References:

https://docs.omniref.com/ruby/gems/softlayer_api/2.1.1/symbols/SoftLayer::ObjectFilter#line=2

Upvotes: 1

Cameron
Cameron

Reputation: 11

slcli supports the use of filters. So you can do:

slcli vs list -H hostnameprefix\*

Just make sure to either quote or escape the special characters.

If you are curious, utils.py provides documentation about what filters can be used.

Upvotes: 1

Related Questions