Advertisement
MDPolaris

Untitled

Apr 24th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.12 KB | None | 0 0
  1. # orch/orch_new_thingworx_instance.sls
  2.  
  3. {% set post_data = salt.pillar.get('event_data') %}
  4. {% set instance_name =  post_data.get("region") ~ '-' ~ post_data.get("cust_name") ~ '-' ~ post_data.get("ext_dns") ~ '-' ~ post_data.get("instance_type") %}
  5. {% set secure_minion = salt['config.get']('salt:secure_minion') %}
  6.  
  7. orch_start_slack_notify:
  8.   salt.function:
  9.     - name: slack.post_message
  10.     - tgt: {{ secure_minion }}
  11.     - kwarg:
  12.         channel: '#experimental'
  13.         message: 'Deployment Orchestration Started: Salt Cloud Deploying AWS Instance: {{ instance_name }}.'
  14.         from_name: salt
  15.         api_key: {{ salt['config.get']('slack:api_key') }}
  16.         icon: 'http://i.imgur.com/n5I6apg.png'
  17.  
  18.  
  19. deploy_salt_cloud_instance:
  20.   salt.runner:
  21.     - name: cloud.profile
  22.     - prof: SALT_CLOUD_PROFILE
  23.     - instances:
  24.      - {{ instance_name }}
  25.     - require:
  26.       - salt: orch_start_slack_notify
  27.  
  28.  
  29. sync_all:
  30.   salt.function:
  31.     - name: saltutil.sync_all
  32.     - tgt: {{ instance_name }}
  33.     - require:
  34.       - salt: deploy_salt_cloud_instance
  35.  
  36.  
  37. set_minion_grains:
  38.   salt.state:
  39.     - tgt: {{ instance_name }}
  40.     - sls:
  41.      - application.setup_grains
  42.     - pillar:
  43.         new_instance_ext_dns: {{ post_data.ext_dns }}.example.com
  44.         new_instance_customer: {{ post_data.cust_name }}
  45.         new_instance_type: {{ post_data.instance_type }}
  46.         new_environment_id: {{ post_data.environmentId }}
  47.     - require:
  48.       - salt: sync_all
  49.  
  50.  
  51. prov_cust_cert:
  52.   salt.state:
  53.     - tgt: {{ secure_minion }}
  54.     - sls:
  55.      - application.provision_ssl_cert
  56.     - pillar:
  57.         new_instance_ext_dns: {{ post_data.ext_dns }}.example.com
  58.     - require:
  59.       - salt: set_minion_grains
  60.  
  61.  
  62. refresh_s3fs:
  63.   salt.runner:
  64.     - name: fileserver.update
  65.     - backend: s3fs
  66.     - require:
  67.       - salt: prov_cust_cert
  68.  
  69.  
  70. add_host_to_ldap:
  71.   salt.state:
  72.     - tgt: {{ instance_name }}
  73.     - sls: common.hostldap
  74.     - require:
  75.       - salt: refresh_s3fs
  76.  
  77.  
  78. run_initial_highstate:
  79.   salt.state:
  80.     - tgt: {{ instance_name }}
  81.     - highstate: True
  82.     - require:
  83.       - salt: add_host_to_ldap
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement