Guest User

Untitled

a guest
Mar 9th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. ---
  2. - hosts: localhost
  3. vars:
  4. solace:
  5. url: "{{ lookup('env','SOLACE_URL') }}"
  6. user: "{{ lookup('env','SOLACE_USER') }}"
  7. password: "{{ lookup('env','SOLACE_PASSWORD') }}"
  8. tasks:
  9. - name: Get msgVpns in solace cluster
  10. uri:
  11. url: "{{ solace.url }}/msgVpns"
  12. method: GET
  13. user: "{{ solace.user}}"
  14. password: "{{ solace.password }}"
  15. status_code: 200
  16. register: msgVpns
  17.  
  18. - name: Get the first msgVpns information in the solace cluster
  19. set_fact:
  20. firstMsgVpn: "{{ msgVpns.json.links[0] }}"
  21.  
  22. - name: Get the queues endpoints
  23. uri:
  24. url: "{{ firstMsgVpn.queuesUri }}"
  25. method: GET
  26. user: "{{ solace.user}}"
  27. password: "{{ solace.password }}"
  28. status_code: 200
  29. register: queues
  30.  
  31.  
  32. - name: Getting a look of the queues
  33. debug:
  34. var: queues
  35.  
  36. - name: Creating the queues
  37. uri:
  38. url: "{{ firstMsgVpn.queuesUri }}"
  39. method: POST
  40. user: "{{ solace.user}}"
  41. password: "{{ solace.password }}"
  42. body:
  43. accessType: non-exclusive
  44. permission: consume
  45. queueName: "{{ item }}"
  46. respectTtlEnabled: true
  47. egressEnabled: true
  48. ingressEnabled: true
  49. body_format: json
  50. register: queuesCreation
  51. when: item not in (queues|json_query('json.data[*].queueName'))
  52. with_items:
  53. - veredi
  54. - parhippi
  55. - moulari
  56.  
  57. - name: Getting a look of the queues
  58. debug:
  59. var: queuesCreation
  60.  
  61.  
  62. - name: Get the queues subscriptions
  63. uri:
  64. url: "{{ firstMsgVpn.queuesUri }}/moulari/subscriptions"
  65. method: GET
  66. user: "{{ solace.user}}"
  67. password: "{{ solace.password }}"
  68. status_code: 200
  69. register: subscriptions
  70.  
  71. - name: Getting a look of the subscriptions
  72. debug:
  73. var: subscriptions
  74.  
  75. - name: Add the queues subscriptions
  76. uri:
  77. url: "{{ firstMsgVpn.queuesUri }}/moulari/subscriptions"
  78. method: POST
  79. user: "{{ solace.user}}"
  80. password: "{{ solace.password }}"
  81. status_code: 200
  82. body:
  83. subscriptionTopic: "{{ item }}"
  84. body_format: json
  85. register: subscriptionsResponse
  86. when: item not in (subscriptions|json_query('json.data[*].subscriptionTopic'))
  87. with_items:
  88. - request/>
  89.  
  90. - name: Getting a look of the subscriptions
  91. debug:
  92. var: subscriptionsResponse
  93.  
  94. # - name: Get the all rest endpoints
  95. # uri:
  96. # url: "{{ firstMsgVpn.topicEndpointsUri }}"
  97. # method: GET
  98. # user: "{{ solace.user}}"
  99. # password: "{{ solace.password }}"
  100. # status_code: 200
  101. # register: topics
  102.  
  103.  
  104. # - name: Getting a look of the topics
  105. # debug:
  106. # var: topics
  107.  
  108. # - name: Get the topics endpoints
  109. # uri:
  110. # url: "{{ firstMsgVpn.topicEndpointsUri }}"
  111. # method: POST
  112. # user: "{{ solace.user}}"
  113. # password: "{{ solace.password }}"
  114. # status_code: 200
  115. # body:
  116. # egressEnabled: true
  117. # ingressEnabled: true
  118. # maxTtl: 3600
  119. # permission: consume
  120. # topicEndpointName: "{{ item }}"
  121. # respectTtlEnabled: true
  122. # body_format: json
  123. # register: topicsCreation
  124. # when: item not in (topics|json_query('json.data[*].topicEndpointName'))
  125. # with_items:
  126. # - request
  127. # - metric
  128.  
  129. # - name: Getting a look of the topics
  130. # debug:
  131. # var: topicsCreation
Add Comment
Please, Sign In to add comment