✓ Solved

Can I use StackScript to rebuild Linodes?

I have hundreds of Linodes on 16.04 Ubuntu that need to be upgraded to 20.04 Ubuntu. I can individually rebuild these but it's going to be a long painful process, I was wondering if it's possible to use a stack script to rebuild the linodes? I need to keep their IP addresses the same otherwise I would just delete and recreate.

1 Reply

✓ Best Answer

I decided to use the Linode CLI to accomplish this.

Got a list of my Linodes with:
linode-cli linodes list --format 'id,label' --text

Then made a for loop bash script that looped through the linode IDs:

#!/bin/bash
for host in $(cat linode_ids.txt)
do
linode-cli linodes rebuild $host --image linode/ubuntu20.04 --root_pass "$(cat password_file.txt)" --authorized_keys "ssh-rsa xxxxx"

done

Reply

Please enter an answer
Tips:

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] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct