Assign variables on multiple VMs | Nutanix Community
Skip to main content
Hi,



I have a Blueprint with two VM (Names: APACHE and MYSQL) and would like to put on both servers an entry into /etc/hosts as "ip - hostname"



I put on every package the following commands:



echo "@@{APACHE.address}@@ @@{APACHE.name}@@ @@{APACHE.name}@@.localdomain" >> /etc/hosts

echo "@@{MYSQL.address}@@ @@{MYSQL.name}@@ @@{MYSQL.name}@@.localdomain" >> /etc/hosts



But I get the following errors:



Application Profile Default > Action Create

Found cycles in tasks

Application Profile Default > Action Delete

Found cycles in tasks

Application Profile Default > Action Soft Delete

Found cycles in tasks

Deployment 6b297d3c_deployment > Action Create

Found cycles in tasks

Deployment 6b297d3c_deployment > Action Delete

Found cycles in tasks

Deployment 6b297d3c_deployment > Action Soft Delete

Found cycles in tasks



How can I assign variables between servers?

thanks!
@guif IF you are trying the access variables from same service then, @@{address}@@ is enough to get the ip address.
But like to put IP/Hostname from VM1 and VM2 on both servers.

What command I need to put ip and hostname?
So on VM1 if you like to access VM1 address then macro is @@{address}@@ and to access VM2 address then it is @@{VM2.address}@@ .
yes. I put this:



Service Name called "APACHE"



echo "@@{address}@@ @@{name}@@ @@{name}@@.localdomain" >> /etc/hosts

echo "@@{MYSQL.address}@@ @@{MYSQL.name}@@ @@{PKG_MYSQL.name}@@.localdomain" >> /etc/hosts



This configuration are correct but when put this on Service Name called "MYSQL"



echo "@@{address}@@ @@{name}@@ @@{name}@@.localdomain" >> /etc/hosts

echo "@@{APACHE.address}@@ @@{APACHE.name}@@ @@{APACHE.name}@@.localdomain" >> /etc/hosts



appears the error:



Application Profile Default > Action Create

Found cycles in tasks

Application Profile Default > Action Delete

Found cycles in tasks

Application Profile Default > Action Soft Delete

Found cycles in tasks



Why not run if put this line on the second VM ?



echo "@@{APACHE.address}@@ @@{APACHE.name}@@ @@{APACHE.name}@@.localdomain" >> /etc/hosts
@guif Because it is a cyclic dependency between both the services. Instead of using service.address you can use substrate.address to avoid this error.
@charan-49230 thanks!