Solved

Assign variables on multiple VMs

  • 18 September 2019
  • 6 replies
  • 3421 views

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!
icon

Best answer by charan-49230 19 September 2019, 19:19

@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

This topic has been closed for comments

6 replies

@charan-49230 thanks!
Userlevel 1
@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.
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
Userlevel 1
So on VM1 if you like to access VM1 address then macro is @@{address}@@ and to access VM2 address then it is @@{VM2.address}@@ .
But like to put IP/Hostname from VM1 and VM2 on both servers.
What command I need to put ip and hostname?
Userlevel 1
@guif IF you are trying the access variables from same service then, @@{address}@@ is enough to get the ip address.