donatello
donatello

Reputation: 6235

How to set up variables in multi-part cloud-init userdata scripts?

I want to be able to set a variable in a shell-script - which is part of a multi-part cloud-init userdata configuration setup, and use this variable in a cloud-config script that comes later in the multi-part userdata.

Is this possible to do? An example would be helpful.

Upvotes: 2

Views: 2705

Answers (1)

whereswalden
whereswalden

Reputation: 4959

You could just use a file. Set the "variable" with echo "value" > /tmp/myvar and get it with echo `cat /tmp/myvar`.

Upvotes: 2

Related Questions