Use a custom resource and separate recipe for service configs with pre-set keys and hostnames
		
			
				
	
	
		
			25 lines
		
	
	
		
			736 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			736 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
#
 | 
						|
# Cookbook Name:: kosmos-base
 | 
						|
# Recipe:: tor_services
 | 
						|
#
 | 
						|
 | 
						|
tor_services = data_bag_item('credentials', 'tor')['services']
 | 
						|
 | 
						|
tor_service "ejabberd" do
 | 
						|
  hostname   tor_services['ejabberd']['hostname']
 | 
						|
  public_key tor_services['ejabberd']['public_key']
 | 
						|
  secret_key tor_services['ejabberd']['secret_key']
 | 
						|
  # TODO configure IP from node attribute
 | 
						|
  # (This is hardcoded for draco atm)
 | 
						|
  ports      [ "5222 148.251.237.73:5222",
 | 
						|
               "5223 148.251.237.73:5223",
 | 
						|
               "5269 148.251.237.73:5269" ]
 | 
						|
end
 | 
						|
 | 
						|
tor_service "web" do
 | 
						|
  hostname   tor_services['web']['hostname']
 | 
						|
  public_key tor_services['web']['public_key']
 | 
						|
  secret_key tor_services['web']['secret_key']
 | 
						|
  ports      ['80 127.0.0.1:80', '443 127.0.0.1:443']
 | 
						|
end
 |