Author Posts

September 19, 2016 at 9:28 pm

I have five nodes in my psd1 and all five node I need a key. Right now I have the key and value in all five nodes.
Is there any way I can put this key in a common place and access in the individual nodes.

Below is the example psd1. Here I have to provide value of ArcherAPIUserPasswd is all the node. I want to put this value in a common place and refer it in the individual nodes. How do I achieve this? Please node that I do not want to remove ArcherAPIUserPasswd from individual nodes.

@{
AllNodes= @(
                   @{
                      NodeName = "*" 
                                    
		        
                     }

                    @{
		         
		         NodeName = "ArchrDvAOCWeb1"                
		         Role  = "ClmOnlineWebServer"
                         ArcherAPIUser = "TsApiUser1"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         
                      }

		    @{
		         
		         NodeName = "ArchrDvAOCWeb2"                
		         Role  = "ClmOnlineWebServer"
                         ArcherAPIUser = "TsApiUser1"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         
                      }
			@{
		         
		         NodeName = "ArchrDvAOCWeb1"                
		         Role  = "ClmOnlineWebServer"
                         ArcherAPIUser = "TsApiUser1"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         
                      }
			@{
		         
		         NodeName = "ArchrDvAOCWeb1"                
		         Role  = "ClmOnlineWebServer"
                         ArcherAPIUser = "TsApiUser1"
			 ArcherAPIUserPasswd = "MyPAssword1"
		        
                      }


)

September 19, 2016 at 9:49 pm

I am not sure I understood your question, can you can elaborate a bit more?
In general you can put the information shared across the nodes under section 'NodeName = "*"' without making any modification to your ps1 file. Node can override this value. An example to share common username across all nodes which is overridden by some nodes:

@{
AllNodes= @(
                   @{
                      NodeName = "*" 
                      ArcherAPIUser = "TsApiUser1"            
		        
                     }

                    @{
		         
		         NodeName = "ArchrDvAOCWeb1"                
		         Role  = "ClmOnlineWebServer"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         
                      }

		    @{
		         
		         NodeName = "ArchrDvAOCWeb2"                
		         Role  = "ClmOnlineWebServer"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         ArcherAPIUser = "TsApiUser2"
                         
                      }
			@{
		         
		         NodeName = "ArchrDvAOCWeb1"                
		         Role  = "ClmOnlineWebServer"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         ArcherAPIUser = "TsApiUser1"
                         
                      }
			@{
		         
		         NodeName = "ArchrDvAOCWeb1"                
		         Role  = "ClmOnlineWebServer"
			 ArcherAPIUserPasswd = "MyPAssword1"
                         ArcherAPIUser = "TsApiUser3"
		        
                      }


)
  • This reply was modified 2 years ago by  Nitin Gupta.

September 20, 2016 at 4:39 am

I understand settings under NodeName = "*" will be accessible across all nodes.
I want to access these values in same psd1 file.
something like below. I want to have all common settings under one hash table and then refer it in individual nodes.

 @{
		         
		         NodeName = "ArchrDvAOCWeb2"                
		         Role  = "ClmOnlineWebServer"
			 ArcherAPIUserPasswd = <>
                         ArcherAPIUser = "TsApiUser2"
                         
                      }

September 20, 2016 at 6:46 am

As Nitin showed in the example he gave, everything that is under the "*" section will be done for all nodes that follow.

You dont have to "reference" it in the node itself.

If a for a specific node you dont want one of the keys to have that "general" value, you can set a different value on that specific node and it will overwrite what comes from the "*" section.

So combining Nitin example and your code, you get this:

@{
AllNodes= @(
              @{
                  NodeName = "*"
                  ArcherAPIUser = "TsApiUser1"
                  ArcherAPIUserPasswd = "MyPAssword1" 
                }

              @{
		          NodeName = "ArchrDvAOCWeb1"                
		          Role  = "ClmOnlineWebServer"
               }

  		      @{
		         
		          NodeName = "ArchrDvAOCWeb2"                
		          Role  = "ClmOnlineWebServer"
               }
			
              @{
                  NodeName = "ArchrDvAOCWeb3"                
		          Role  = "ClmOnlineWebServer"
               }
			  
              @{
		          NodeName = "ArchrDvAOCWeb4"                
		          Role  = "ClmOnlineWebServer"
                          ArcherAPIUser = "TsApiUser2"
                          ArcherAPIUserPasswd = "MyPAssword2"
               }
)}

Note the fourth node, I wanted to use a different user and password for example.

  • This reply was modified 2 years ago by  Arie H.
  • This reply was modified 2 years ago by  Arie H.