Announcement - A library and tool for creating clusters on Linode

Hi all,

I've had some experience deploying big data stacks - Solr search engines, hadoop, HDFS, Spark, Tensorflow deep learning,

Storm, Ceph, Gluster, etc - on Linode over the past couple of years,

and based on those experiences, I'm implementing a library and tool called Linode Cluster Toolkit and LinodeTool.

The project is available on GitHub:

The toolkit itself is a Python library for use by applications, but it also installs a command-line tool called 'linodetool' which

can be used for cluster and node provisioning.

It's currently under active feature development.

My article about this toolkit at … 75475011ef"> has more detailed description of the ideas.

I'd be very happy if forum members can give me feedback and feature requests on the concepts, code and tools.

I'll be monitoring this thread and answering any questions you have.

Thank you

Karthik Shiraly

5 Replies

I installed the lct following the installation for python 2. when I then try to run the command to save the secret key i get an error message. Do you know why?

linodetool secret set personal-token |personal access token|

Traceback (most recent call last):
File "/bin/linodetool", line 9, in <module>
loadentrypoint('linode-cluster-toolkit==0.1.0', 'consolescripts', 'linodetool')() File "/usr/lib/python2.7/site-packages/", line 378, in loadentrypoint
return getdistribution(dist).loadentrypoint(group, name) File "/usr/lib/python2.7/site-packages/", line 2566, in loadentrypoint
return ep.load()
File "/usr/lib/python2.7/site-packages/", line 2260, in load entry = import(self.modulename, globals(),globals(), ['name'])
File "/usr/lib/python2.7/site-packages/lct/", line 1, in <module>
from .toolkit import Toolkit, ToolkitContext
File "/usr/lib/python2.7/site-packages/lct/", line 5, in <module>
from .linodeapi.apiservice import APIService File "/usr/lib/python2.7/site-packages/lct/linodeapi/", line 126$linode_id/ips
SyntaxError: invalid syntax</module></module></module>

@sdennis69 I looked at the offending line…

It appears this code has a syntax error.

More importantly this code's last commit was July 2017. During this time the API was under "early release" status. We've made a whole slew of breaking changes since then. This code probably won't work entirely in its current state. It will need some commits to come back up to speed.

Two other things…

  1. you might to check out our Python CLI. Its a great way to spin up lots of infrastructure. I personally use this tool in conjunction with stackscripts and a CM tool(Salt in my case) to spin up clusters.
  2. I am going to edit your post to remove that personal access token. This can be used to grant access to your account.

Ah, thanks for the awesome feedback. I was hoping someone would point me in the right direction.

would you happen to have an example of how to use your CLI to spin up a cluster with stackscripts? I checked out the github but didnt see anything about how to do it. Can you provision clusters with images too? if you know where i can find more info, im all over it.

@sdennis69 Sure do.

Step 1: Install the thing

You need to install and configure the Linode CLI. The instructions can be found here

As part of the installation you'll be asked for a PAT(personal access token). Instructions for generating this can be found here

Step 2: Use the thing

Here is a really stripped down stackscript. All this does is lockdown ssh, setup a firewall, set the hostname,create a sudoer, and install my public key so I can ssh in. You can extend this to configure and install whatever you want.

The Stackscript

# This block defines the variables the user of the script needs to input
# when deploying using this script.
#<UDF name="hostname" label="The hostname for the new Linode.">
#<UDF name="admin_username" label="the name of the remote admin user">
#<UDF name="admin_password" label="the password for remote admin user">
#<UDF name="admin_public_key" label="the remote admin public key">

set -x

# sets hostname
hostnamectl set-hostname $HOSTNAME

# This updates the packages on the system from the distribution repositories.
apt-get update
apt-get upgrade -y

#install a user and add keys
useradd -m -p $(openssl passwd -1 $ADMIN_PASSWORD) -s /bin/bash -G sudo $ADMIN_USERNAME

mkdir $SSHDIR

chmod 700 $SSHDIR
touch $SSHDIR/authorized_keys
chmod 644 $SSHDIR/authorized_keys
echo $ADMIN_PUBLIC_KEY >> $SSHDIR/authorized_keys

#lock down ssh
sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
echo "AddressFamily inet" >> /etc/ssh/sshd_config
sudo systemctl restart sshd

#install and configure ufw
apt-get -y install ufw
ufw deny incoming
ufw allow OpenSSH
echo 'y' | ufw enable

The CLI Command in a bash envelope for iteration

for i in $(seq 5 $END) 
    linode-cli linodes create --type g6-nanode-1 --region us-east --stackscript_id <your stackscript id> --stackscript_data "{\"hostname\":\"myhost$i\",\"admin_username\":\"myadminuser\",\"admin_password\":\"thepassword\",\"admin_public_key\":\"<a legit public key>"}" --image linode/ubuntu18.04 --label hostlabel$i --root_pass <root-password>

Here is a CLI command that boots 5 linodes using my stackscript. You'll notice two things.

  1. A blob of json associated with the stackscript_data switch. These correspond the UDF fields in the stackscript
  2. a stackscript_id. Once you've installed your stackscript through the manager this can be obtained with the following CLI command linode-cli stackscripts list --is_public false

Can you provision clusters with images too

You sure can. This would effectively mean image-izing a linode after you baked it with a stackscript or configured it by hand. All the info for creating and managing images can be found here In the CLI its as simple as specifying the image you want to boot. The only advantage over stackscripts is boot time. All the install commands and package manager runs are pre-baked into the image. One caveat, images are limited to 2GB after compression so sometimes it can be tricky to fit a fully configured OS. A workaround for this is booting from block storage volumes( The size limit on these is 10TB.

Debugging hot tip

you'll see I set the set -x flag in that stackscript. If you boot a linode with this and drop into the lish console you can watch the console output of the stackscript. It will be executed at the end of the boot sequence. This is very useful if steps are hanging or failing for some reason

Super hot tip

We are also collaborating on terraform support to increase our infrastructure as code capabilities. This isn't official yet, but you can get on the ground floor in these repos.

Linode Terraform Provider\

Linode Go wrapper


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct