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

Assign variables on multiple VMs

  • 18 September 2019
  • 6 replies
  • 2224 views

  • Adventurer
  • 3 replies
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!

Best answer by charan-49230

@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.
View original
Did this topic help you find an answer to your question?
This topic has been closed for comments

6 replies

  • Nutanix Employee
  • 25 replies
  • September 18, 2019
@guif IF you are trying the access variables from same service then, @@{address}@@ is enough to get the ip address.

  • Author
  • Adventurer
  • 3 replies
  • September 18, 2019
But like to put IP/Hostname from VM1 and VM2 on both servers.
What command I need to put ip and hostname?

  • Nutanix Employee
  • 25 replies
  • September 18, 2019
So on VM1 if you like to access VM1 address then macro is @@{address}@@ and to access VM2 address then it is @@{VM2.address}@@ .

  • Author
  • Adventurer
  • 3 replies
  • September 18, 2019
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

  • Nutanix Employee
  • 25 replies
  • Answer
  • September 19, 2019
@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.

  • Author
  • Adventurer
  • 3 replies
  • September 20, 2019