Hi All,
I’ve been working with Chef on Windows for configuring IIS. While I am getting on fine configuring the basics I’ve got to a point where I’m stuck. I can’t work out how to use different usernames and passwords in the same Chef recipe.
Lets say I have two servers that are identical, Server A and Server B, they are both test environments. The config on both servers is identical other than the username and passwords they use for the service account.
Server A
RecipeWebSite to setup IIS, but uses:
UsernameA
PasswordA
Server B
RecipeWebSite to setup IIS, but uses:
UsernameA
PasswordB
For usernames, I’ve gone down the route of calculating the username based on the server name within the recipe like this:
# Calculate username
base_username = "service_account_"
server = "#{ENV['COMPUTERNAME']}"
server_no = server[-2, 2]
pool_username = base_username+server_no
However, this won’t work for the passwords.
In my case, I actually have 10 test environments, so there are quite a number of usernames and passwords I need to substitute.
Thanks, AA.