Technically Speaking

The Official Bigstep Blog

 

Releasing a Brand New Metal Cloud CLI

We have just released our new Metal Cloud CLI, a new tool that will allow sysadmins to move a lot faster in working with metal cloud infrastructure elements. It is written in go and it is available on Bigstep's Github repository. Scroll down for details. 

Installing metalcloud-cli

The CLI is a lightweight, single binary application written in go. We provide packages for all major platforms including MacOS and Windows.

Mac OS X

brew tap bigstepinc/homebrew-repo
brew install metalcloud-cli

Linux

Deb and RPM packages available on Github. Use the installation method apropriate for your environment. Some examples are provided on the project's github page. 

Ubuntu/Debian

curl -sLO https://github.com/bigstepinc/metalcloud-cli/releases/download/v1.0.3/metalcloud-cli_1.0.3_linux_amd64.deb && sudo dpkg -i metalcloud-cli_1.0.3_linux_amd64.deb

CentOS/Redhat

sudo rpm -i https://github.com/bigstepinc/metalcloud-cli/releases/download/v1.0.3/metalcloud-cli_1.0.3_linux_amd64.rpm

Go install tool (all platforms, including Windows)

go get github.com/bigstepinc/metalcloud-cli

Getting started

Configure access credentials as environment variables:


export METALCLOUD_API_KEY="<your key>"
export METALCLOUD_ENDPOINT="https://api.bigstep.com/metal-cloud"
export METALCLOUD_USER_EMAIL="<your email>"
export METALCLOUD_DATACENTER="uk-reading"

To create an infrastructure:

$ metalcloud-cli create infrastructure -label test

$ metalcloud-cli list infrastructure 
+-------+-----------------------------------------+-------------------------------+-----------+-----------+---------------------+---------------------+
| ID    | LABEL                                   | OWNER                         | REL.      | STATUS    | CREATED             | UPDATED             |
+-------+-----------------------------------------+-------------------------------+-----------+-----------+---------------------+---------------------+
| 12345 | test                            | d.d@sdd.com                   | OWNER     | active    | 2019-03-28T15:23:08Z| 2019-03-28T15:23:08Z|
+-------+-----------------------------------------+-------------------------------+-----------+-----------+---------------------+---------------------+

To create an instance array in that infrastructure:

metalcloud-cli create instance_array -infra test -label master -proc 1 -proc_core_count 8 -ram 16

metalcloud-cli list instance_array -infra test
+-------+---------------------+---------------------+-----------+ | ID | LABEL | STATUS | INST_CNT | +-------+---------------------+---------------------+-----------+ | 54321 | master | ordered | 1 | +-------+---------------------+---------------------+-----------+ Total: 1 Instance Arrays

To create a drive array and attach it to the previous instance array:

$ metalcloud-cli create drive_array -infra test -label master-da -ia 54321

To view the current status of the infrastructure

$ metalcloud-cli get infrastructure -id 12345
Infrastructures I have access to (as test@test.com)
+-------+----------------+-------------------------------+-----------------------------------------------------------------------+-----------+
| ID    | OBJECT_TYPE    | LABEL                         | DETAILS                                                               | STATUS    |
+-------+----------------+-------------------------------+-----------------------------------------------------------------------+-----------+
| 36791 | InstanceArray  | master                        | 1 instances (16 RAM, 8 cores, 1 disks)                                | ordered   |
| 47398 | DriveArray     | master-da                     | 1 drives - 40.0 GB iscsi_ssd (volume_template:0) attached to: 36791   | ordered   |
+-------+----------------+-------------------------------+-----------------------------------------------------------------------+-----------+
Total: 2 elements

This is the output of the metalcloud-cli help command:

Syntax: ./metalcloud-cli <command> [args]
Accepted commands:
Command: create infrastructure     Creates an infrastructure. (alternatively use "new infra")
	  -dc                        (Required) Infrastructure datacenter
	  -label                     (Required) Infrastructure's label
	  -return_id                 (Flag) If set will print the ID of the created infrastructure. Useful for automating tasks.
	  -h                         Show command help and exit.
 Command: list infrastructure       Lists all infrastructures. (alternatively use "ls infra")
	  -format                    The output format. Supported values are 'json','csv'. The default format is human readable.
	  -h                         Show command help and exit.
 Command: delete infrastructure     Delete an infrastructure. (alternatively use "rm infra")
	  -autoconfirm               (Flag) If set it does not ask for confirmation anymore
	  -id                        (Required) Infrastructure's id or label. Note that using the 'label' might be ambiguous in certain situations.
	  -h                         Show command help and exit.
 Command: deploy infrastructure     Deploy an infrastructure. (alternatively use "apply infra")
	  -allow_data_loss           (Flag) If set, deploy will throw error if data loss is expected.
	  -autoconfirm               (Flag) If set operation procedes without asking for confirmation
	  -id                        (Required) Infrastructure's id or label. Note that using the 'label' might be ambiguous in certain situations.
	  -no_attempt_soft_shutdown  (Flag) If set,do not atempt a soft (ACPI) power off of all the servers in the infrastructure before the deploy
	  -no_hard_shutdown_after_timeout (Flag) If set do not force a hard power off after timeout expired and the server is not powered off.
	  -skip_ansible              (Flag) If set, some automatic provisioning steps will be skipped. This parameter should generally be ignored.
	  -soft_shutdown_timeout_seconds (Optional, default 180) Timeout to wait if hard_shutdown_after_timeout is set.
	  -h                         Show command help and exit.
 Command: get infrastructure        Get an infrastructure. (alternatively use "show infra")
	  -format                    The output format. Supported values are 'json','csv'. The default format is human readable.
	  -id                        (Required) Infrastructure's id or label. Note that using the 'label' might be ambiguous in certain situations.
	  -h                         Show command help and exit.
 Command: revert infrastructure     Revert all changes of an infrastructure. (alternatively use "undo infra")
	  -autoconfirm               (Flag) If set it does not ask for confirmation anymore
	  -id                        (Required) Infrastructure's id or label. Note that using the 'label' might be ambiguous in certain situations.
	  -h                         Show command help and exit.
 Command: create instance_array     Creates an instance array. (alternatively use "new ia")
	  -boot                      InstanceArray's boot type:'pxe_iscsi','local_drives'
	  -disk_size                 InstanceArray's local disks' size in MB
	  -disks                     InstanceArray's number of local drives
	  -firewall_management_disabled (Flag) If set InstanceArray's firewall management on or off
	  -infra                     (Required) Infrastructure's id or label. Note that the 'label' this be ambiguous in certain situations.
	  -instance_count            (Required) Instance count of this instance array
	  -label                     InstanceArray's label
	  -proc                      InstanceArray's minimum processor count
	  -proc_core_count           InstanceArray's minimum processor core count
	  -proc_freq                 InstanceArray's minimum processor frequency (Mhz)
	  -ram                       InstanceArray's minimum RAM (GB)
	  -return_id                 (Flag) If set will print the ID of the created Instance Array. Useful for automating tasks.
	  -template                  InstanceArray's volume template when booting from for local drives
	  -h                         Show command help and exit.
 Command: list instance_array       Lists all instance arrays of an infrastructure. (alternatively use "ls ia")
	  -format                    The output format. Supported values are 'json','csv'. The default format is human readable.
	  -infra                     (Required) Infrastructure ID
	  -h                         Show command help and exit.
 Command: delete instance_array     Delete instance array. (alternatively use "rm ia")
	  -autoconfirm               If true it does not ask for confirmation anymore
	  -id                        (Required) InstanceArray ID
	  -h                         Show command help and exit.
 Command: edit instance_array       Edits an instance array. (alternatively use "alter ia")
	  -boot                      InstanceArray's boot type:'pxe_iscsi','local_drives'
	  -disk_size                 InstanceArray's local disks' size in MB
	  -disks                     InstanceArray's number of local drives
	  -do_not_keep_detaching_drives (Flag) If set and the number of Instance objects is reduced, then the detaching Drive objects will be deleted. If it's set to true, the detaching Drive objects will not be deleted.
	  -firewall_management_disabled (Flag) If set InstanceArray's firewall management is off
	  -id                        (Required) InstanceArray's id
	  -instance_count            Instance count of this instance array
	  -label                     (Required) InstanceArray's label
	  -proc                      InstanceArray's minimum processor count
	  -proc_core_count           InstanceArray's minimum processor core count
	  -proc_freq                 InstanceArray's minimum processor frequency (Mhz)
	  -ram                       InstanceArray's minimum RAM (GB)
	  -swap_existing_hardware    (Flag) If set all the hardware of the Instance objects is swapped to match the new InstanceArray specifications
	  -template                  InstanceArray's volume template when booting from for local drives
	  -h                         Show command help and exit.
 Command: create drive_array        Creates a drive array. (alternatively use "new da")
	  -count                     DriveArrays's drive count. Use this only for unconnected DriveArrays.
	  -ia                        (Required) The id of the instance array it is attached to. It can be zero for unattached Drive Arrays
	  -infra                     (Required) Infrastructure ID
	  -label                     (Required) The label of the drive array
	  -no_expand_with_ia         (Flag) If set, auto-expand when the connected instance array expands is disabled
	  -return_id                 (Optional) Will print the ID of the created Drive Array. Useful for automating tasks.
	  -size                      (Optional, default = 40960) Drive arrays's size in MBytes
	  -template                  DriveArrays's volume template to clone when creating Drives
	  -type                      Possible values: iscsi_ssd, iscsi_hdd
	  -h                         Show command help and exit.
 Command: edit drive_array          Edit a drive array. (alternatively use "alter da")
	  -count                     DriveArrays's drive count. Use this only for unconnected DriveArrays.
	  -expand_with_ia            Auto-expand when the connected instance array expands
	  -ia                        (Required) The id of the instance array it is attached to. It can be zero for unattached Drive Arrays
	  -id                        (Required) Drive Array's ID
	  -label                     (Required) The label of the drive array
	  -size                      (Optional, default = 40960) Drive arrays's size in MBytes
	  -template                  DriveArrays's volume template to clone when creating Drives
	  -type                      Possible values: iscsi_ssd, iscsi_hdd
	  -h                         Show command help and exit.
 Command: list drive_array          Lists all drive arrays of an infrastructure. (alternatively use "ls da")
	  -format                    The output format. Supported values are 'json','csv'. The default format is human readable.
	  -infra                     (Required) Infrastructure ID
	  -h                         Show command help and exit.
 Command: delete drive_array        Delete a drive array. (alternatively use "rm da")
	  -autoconfirm               If true it does not ask for confirmation anymore
	  -id                        (Required) DriveArray's ID
	  -h                         Show command help and exit.
 Command: list volume_templates     Lists available volume templates (alternatively use "ls templates")
	  -format                    The output format. Supported values are 'json','csv'. The default format is human readable.
	  -local_only                Show only templates that support local install
	  -pxe_only                  Show only templates that support pxe booting
	  -h                         Show command help and exit.
 Command: list firewall_rule        Lists instance array firewall rules (alternatively use "ls fw")
	  -format                    The output format. Supported values are 'json','csv'. The default format is human readable.
	  -ia                        (Required) The instance array id
	  -h                         Show command help and exit.
 Command: add firewall_rule         Add instance array firewall rule (alternatively use "new fw")
	  -description               The firewall rule's description.
	  -destination               The destination address to filter on. It can also be a range with the start and end values separated by a dash.
	  -ia                        (Required) The instance array id
	  -ip_address_type           The IP address type of the firewall rule. Possible values: ipv4, ipv6.
	  -port                      The port to filter on. It can also be a range with the start and end values separated by a dash.
	  -protocol                  The protocol of the firewall rule. Possible values: all, icmp, tcp, udp.
	  -source                    The source address to filter on. It can also be a range with the start and end values separated by a dash.
	  -h                         Show command help and exit. 
 Command: delete firewall_rule      Remove instance array firewall rule (alternatively use "rm fw")
	  -destination               The destination address to filter on. It can also be a range with the start and end values separated by a dash.
	  -ia                        (Required) The instance array id
	  -ip_address_type           The IP address type of the firewall rule. Possible values: ipv4, ipv6.
	  -port                      The port to filter on. It can also be a range with the start and end values separated by a dash.
	  -protocol                  The protocol of the firewall rule. Possible values: all, icmp, tcp, udp.
	  -source                    The source address to filter on. It can also be a range with the start and end values separated by a dash.
	  -h                         Show command help and exit.

We hope you enjoy it and let us know your feedback! 

Got a question? Need advice? We're just one click away.
Sharing is caring:TwitterFacebookLinkedinPinterestEmail

Readers also enjoyed:

Black Friday 2019: How to Be a Success Story

Black Friday is just around the corner. If you have an e-commerce website, you must have big hopes and dreams for one of the most profitable days of the…

Halloween Quiz Results: Sysadmin "Specs" & How to Trick or Treat Them

We've run a quirky Halloween quiz to try to get the steam out of a busy day for sysadmins. After all, all work and no play makes Jack a dull boy.…

Leave a Reply

Your email address will not be published.

* Required fields to post your comments.
Please review our Privacy Notice in order to understand how we process your personal data and what are your rights in this respect.