Advertisement
Guest User

templates for erb to j2

a guest
Aug 7th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. gearman.yaml.j2
  2. instances:
  3. {% node['datadog']['services']['gearmand'].each do |i| -%}
  4.   - server: {{['ipv4']['address']}}
  5.     port: {{"port" OR 4730 }}
  6.     {% if i.key?("tags") -%}
  7.     tags:
  8.       {% i["tags"].each do |t| -%}
  9.       - {{ t }}
  10.       {% endif -%}
  11.     {% endif -%}
  12. {% endif-%}
  13.  
  14. init_config:
  15. % nothing to add here
  16.  
  17.  
  18.  
  19. mysql.yaml.j2
  20. instances:
  21. {% node['datadog']['services']['mysql'].each do |i| -%}
  22.   - server: {{ i['host'] }}
  23.     user: {{ i['username'] }}
  24.     pass: {{ i['password'] }}
  25.     {% if i.key?('sock') -%}
  26.     sock: {{ i['sock'] }}
  27.     {% endif -%}
  28.   {% if i.key?('tags') -%}
  29.     tags:
  30.     {% i['tags'].each do |t| -%}
  31.     - {{ t }}
  32.     {% endif -%}
  33.   {% endif -%}
  34.   {% if i.key?('options') -%}
  35.     options:
  36.     {% i['options'].each do |o| -%}
  37.       {{ o }}
  38.     {% endif -%}
  39.   {% endif -%}
  40. {% endif -%}
  41.  
  42. # Nothing to configure here
  43. init_config:
  44.  
  45.  
  46. nginx.yaml.j2
  47. instances:
  48. {% node['datadog']['services']['nginx'].each do |i| -%}
  49.   - nginx_status_url: {{ i['nginx_status_url'] }}
  50.   {% if i.key?('tags') -%}
  51.     tags:
  52.     {% i['tags'].each do |t| -%}
  53.     - {{ t }}
  54.     {% endif -%}
  55.   {% endif -%}
  56. {% endif -%}
  57.  
  58.  
  59.  
  60.  
  61. redisdb.yaml.j2
  62. instances:
  63. {% node['datadog']['services']['redisdb'].each do |i| -%}
  64.   - host: {{"datadog_server"}}
  65.     port: {{"datadog_port" | 6379 }}
  66.     {% if "key" equals  ("password") -%}
  67.     password: {{"password"}}
  68.     {% endif -%}
  69.     {% if "key" equals ("tags") -%}
  70.     tags:
  71.       {% i["tags"].each do |t| -%}
  72.       - {{ t }}
  73.       {% endif -%}
  74.     {% endif -%}
  75. {% endif -%}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement