daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% set tag = salt.pillar.get('event_tag') %}
  2. {% set data = salt.pillar.get('event_data') %}
  3.  
  4. {% set env = data['data']['env'] %}
  5. {% set shard = data['data']['shard'] %}
  6. {% set datacenter = data['data']['datacenter'] %}
  7.  
  8. {% set s_master = salt['pillar.get']('envinfo:' ~ datacenter ~ ':saltmaster') -%}
  9.  
  10. {% set domain = datacenter ~ '.domain.com' %}
  11.  
  12. {% set compound = 'G@role:dc and G@shard:' ~ shard ~ ' and G@environment:' ~ env %}
  13. {% set dc = salt.saltutil.runner('mine.get',
  14.   tgt=compound,
  15.   fun='host_name',
  16.   tgt_type='compound').values()[0] %}
  17.  
  18. {% if salt['pillar.get'](env ~ ':' ~ datacenter ~ ':' ~ shard ~ ':has_dc') == 'true' %}
  19.  
  20. deploy_dc:
  21.   file.managed:
  22.     - name: /tmp/hasdc-true
  23.     - contents: {{ has_dc }}
  24.     - mode: 664
  25.     - user: root
  26.     - group: root
  27.  
  28. {% else %}
  29.  
  30. deploy_dc:
  31.   file.managed:
  32.     - name: /tmp/hasdc-false
  33.     - contents: 'Test'
  34.     - mode: 664
  35.     - user: root
  36.     - group: root
  37.  
  38. {% endif %}
RAW Paste Data
Top