Host assigned wrong role on machine with 2 tentacles

I’m working on a Blue/Green deployment POC and running scripts on host in two different environments to essentially make one live and bring another one off-line.

I’ve found helpful information in a solution mentioned by Matt Richardson in this thread: https://help.octopusdeploy.com/discussions/questions/10632-run-script-on-non-deployed-environment

I’ve installed 2 tentacles on a machine and assigned them different names and roles, to target them differently based on whether they are going to be made live or not as part of the blue green deployment.

The following is my scenario:
Blue environment - DRH-POC-SlrPrGrNonLive - with role ‘non-active-stc-solr-primary’
Green environment - DRH-POC-SlrPrGr - with role ‘stc-solr-primary’

A powershell script is used to update the machines based on role. When the script is run against the ‘DRH-POC-SlrPrGrNonLive’ host, it seems that the role getting associated with that host, may be the role from the ‘DRH-POC-SlrPrGr’ server.

Including screenshots of the step log and the blue environment hosts: BlueHosts

The script being called references the “Octopus.Machine.Roles” variable to determine what action to perform.

This is the portion that handles processing based on the role:

    	if($Arke.Machine.HasRole("stc-solr-primary"))
	{
		#Instance needs to be set as source
		Write-Host "Pushing configuration to zookeepers for role: stc-solr-primary"
		$sourceConfigDir = Join-Path $BlueGreen.Solr.SolrInstall -ChildPath "server\solr\configsets\sitecore_analytics_live_index_source\conf"
		Push-ConfigToZookeepers -solrPath $BlueGreen.Solr.SolrInstall -zookeepers $BlueGreen.Solr.Zookeepers -configName $configName -configDir $sourceConfigDir
		return
	}

if($Arke.Machine.HasRole("non-active-stc-solr-primary"))
{
	#Instance needs to be set as target
	Write-Host "Pushing configuration to zookeepers for role: non-active-stc-solr-primary"
	$targetConfigDir = Join-Path $BlueGreen.Solr.SolrInstall -ChildPath "server\solr\configsets\sitecore_analytics_live_index_target\conf"
	Push-ConfigToZookeepers -solrPath $BlueGreen.Solr.SolrInstall -zookeepers $BlueGreen.Solr.Zookeepers -configName $configName -configDir $targetConfigDir
	return
} 

Are there known issues with running 2 tentacles on the same machine to assign them to different environments? I expected that the role ‘non-active-stc-solr-primary’ would’ve been defined for the ‘DRH-POC-SlrPrGrNonLive’ host, but it seems something isn’t quite right and I’m not sure what that could be.

Any assistance would be appreciated!

Hi,

I’ve done some testing on a local instance with 2 Tentacles installed on the same server and the roles for each machine was correct.

Would you be able to provide me with the script that you are running for me to have a look at to troubleshoot this issue?

Thank you and best regards,
Henrik

Henrik,

Thanks for looking into this.
BlueGreenScripts.zip (5.2 KB)
I’ve attached the script and related pieces that are used in the process. A powershell script step calls the BlueGreenSolr.ps1 file that is used to update configurations on a blue server as well as a green server that was added to the blue environment using a second tentacle.

I’ve looked over the deployment targets and roles all seem correct, so I’m unsure in this instance why the green server is not passing the role that it is assigned.

Please let me know if you need any additional information.

Thanks,
Bill

Henrik,

I may have figured out the cause it’s not related to the tentacle at all.

In the script when I check for the role, I was using -match instead of -contains, which would provide a true result when searching for ‘stc-solr-primary’ when the machine role is ‘non-active-stc-solr-primary’, thus matching the first condition in the script which is not was intended.

It’s safe to say that this particular issue was user error. I’ve updated the script and the process now completes as expected.

Thank you for your help with this!

Bill

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.