diff options
author | elijah <elijah@riseup.net> | 2013-05-14 12:23:20 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-05-14 12:23:20 -0700 |
commit | b3d1c6c58838b0c4f368bc42493ac3bae280b5af (patch) | |
tree | 0763e27a19a4729f30259297c46ecb04f8f60518 | |
parent | 4132a1b857c79670ef457ae7e11b77b6ff2c477b (diff) |
added smtp-service.json, requires latest leap_cli
-rw-r--r-- | provider_base/files/service-definitions/v1/smtp-service.json.erb | 29 | ||||
-rw-r--r-- | provider_base/services/webapp.json | 3 | ||||
-rw-r--r-- | puppet/modules/site_webapp/manifests/init.pp | 5 |
3 files changed, 36 insertions, 1 deletions
diff --git a/provider_base/files/service-definitions/v1/smtp-service.json.erb b/provider_base/files/service-definitions/v1/smtp-service.json.erb new file mode 100644 index 00000000..68d4bbab --- /dev/null +++ b/provider_base/files/service-definitions/v1/smtp-service.json.erb @@ -0,0 +1,29 @@ +<%= + def underscore(words) + words = words.to_s.dup + words.downcase! + words.gsub! /[^a-z]/, '_' + words + end + + hsh = {} + hsh["serial"] = 1 + hsh["version"] = 1 + locations = {} + hosts = {} + nodes_like_me[:services => 'mx'].each_node do |node| + host = {} + host["hostname"] = node.domain.full + host["ip_address"] = node.ip_address + host["port"] = 25 # hard coded for now, later node.smtp.port + if node['location'] + location_name = underscore(node.location.name) + host["location"] = location_name + locations[location_name] ||= node.location + end + hosts[node.name] = host + end + hsh["hosts"] = hosts + hsh["locations"] = locations + generate_json hsh +%>
\ No newline at end of file diff --git a/provider_base/services/webapp.json b/provider_base/services/webapp.json index 4b2f7c26..1fe5cf7b 100644 --- a/provider_base/services/webapp.json +++ b/provider_base/services/webapp.json @@ -23,7 +23,8 @@ "definition_files": { "provider": "= file :provider_json_template", "eip_service": "= file [:eip_service_json_template, 'v'+webapp.api_version.to_s]", - "soledad_service": "= file [:soledad_service_json_template, 'v'+webapp.api_version.to_s]" + "soledad_service": "= file [:soledad_service_json_template, 'v'+webapp.api_version.to_s]", + "smtp_service": "= file [:smtp_service_json_template, 'v'+webapp.api_version.to_s]" }, "service_type": "public_service", "api": { diff --git a/puppet/modules/site_webapp/manifests/init.pp b/puppet/modules/site_webapp/manifests/init.pp index 8e0aa11c..5c084a0c 100644 --- a/puppet/modules/site_webapp/manifests/init.pp +++ b/puppet/modules/site_webapp/manifests/init.pp @@ -4,6 +4,7 @@ class site_webapp { $provider = $definition_files['provider'] $eip_service = $definition_files['eip_service'] $soledad_service = $definition_files['soledad_service'] + $smtp_service = $definition_files['smtp_service'] $node_domain = hiera('domain') $provider_domain = $node_domain['full_suffix'] $webapp = hiera('webapp') @@ -96,6 +97,10 @@ class site_webapp { "/srv/leap-webapp/public/${api_version}/config/soledad-service.json": content => $soledad_service, owner => leap-webapp, group => leap-webapp, mode => '0644'; + + "/srv/leap-webapp/public/${api_version}/config/smtp-service.json": + content => $smtp_service, + owner => leap-webapp, group => leap-webapp, mode => '0644'; } try::file { |