Good morning everyone,
This is my first post here and hopefully i will get unblocked.
So, What a need to do is theoretically simple, I need to use one variable to set one configuration for my service based on the instance name.
This is the scenario:
I have a variable called address
that is used in this line on my service configuration:
server ${address} 255.255.0.0
However this variable address
should be set based on the host name, to do this I’m using this block of code:
address_1="10.10.1.0";
address_2="10.10.2.0";
address="";
system.activationScripts.script.text = ''
if [ "$(cat /etc/ec2-tags/name)" == "instance-1" ]; then
${address}=${address_1}
else
${address}=${address_2}
fi
'';
The logic of this above code is, if the hostname is “instance-1” the variable address
will receive the value of address_1
if not the address will receive address_2
.
The if clause is working, however when i deploy the variable address is receiving this value: “=10.10.1.0”
My need is set the value to address variable that will be used in the next block of code.
Any ideas?