StackScripts: How / When do they execute ?

Hello,
I am kind of new here and i have been looking into stackscripts and honestly I am pretty lost now. I looked around this forum but nothing really seems to work.

So I was initially trying to create a stackscript that would install saltstack minion. But it seems a simple script for making a directory is not working. Am i doing something wrong here ?

Here is the simplest of scripts i tried to run on Ubuntu 18 LTS:

#!/bin/bash

mkdir test

All I see is this script pasted with executable permissions in the root directory. I can go in and execute it and it does create a test directory. Is there no way for these scripts to be executed upon the creation of the machine? I thought that was the whole idea behind stackscripts "Run once upon machine creation" ?

1 Reply

StackScripts are executed upon deployment of the machine automatically.

I just tested your example StackScript with a fresh Ubuntu Linode, and the "test" directory was successfully created under the root directory:

root@localhost:~# ls /
bin   dev  home  lib32  libx32      media  opt   root  sbin  srv  test  usr
boot  etc  lib   lib64  lost+found  mnt    proc  run   snap  sys  tmp   var

What other sorts of issues are you having trouble with? Our StackScript guides may be more useful than what you're able to find in this Community Site:

We also have a series of guides on using SaltStack that you may find useful:

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