forked from JNPRAutomate/ansible-junos-evpn-vxlan
-
Notifications
You must be signed in to change notification settings - Fork 2
/
pb.rav.token.create-deploy.yaml
99 lines (87 loc) · 3.14 KB
/
pb.rav.token.create-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
- name: Create Application on Ravello for CI
connection: local
hosts: all
gather_facts: no
roles:
- ravello.lib
pre_tasks:
- include_vars: "{{ topology_file }}"
vars:
ravello_deploy_topology_cloud: AMAZON
ravello_deploy_topology_region: Oregon
ravello_deploy_topology_optimization: PERFORMANCE_OPTIMIZED
ravello_deploy_topology_start_all: true
tasks:
- name: Create Application from Blueprint for CI
uri:
url: "https://cloud.ravellosystems.com/api/v1/applications/"
method: POST
status_code: 201
HEADER_Content-Type: 'application/json'
HEADER_Accept: 'application/json'
HEADER_X-Ephemeral-Token-Authorization: "{{ ravello_ci_token }}"
body:
name: "{{ ravello_ci_app_name }}"
description: "App created by Travis CI"
baseBlueprintId: "{{ ravello_ci_blueprint }}"
body_format: json
run_once: true
changed_when: true
- name: Get App ID from Ravello
ravello_get_id:
resource_name: "{{ ravello_ci_app_name }}"
resource_type: applications
token: "{{ ravello_ci_token }}"
register: app
run_once: true
- debug: var=app
run_once: true
#######################################################
## Deploy Application(s) ##
#######################################################
- name: Deploy Application On Ravello
uri:
url: "https://cloud.ravellosystems.com/api/v1/applications/{{ app.json.id }}/publish"
method: POST
status_code: 202
HEADER_Content-Type: 'application/json'
HEADER_Accept: 'application/json'
HEADER_X-Ephemeral-Token-Authorization: "{{ ravello_ci_token }}"
body: >
{
"preferredCloud": "{{ ravello_deploy_topology_cloud }}",
"preferredRegion": "{{ ravello_deploy_topology_region }}",
"optimizationLevel": "{{ ravello_deploy_topology_optimization }}",
"startAllVms": "{{ ravello_deploy_topology_start_all }}"
}
body_format: json
run_once: true
########################################
## Set application Expiration time ##
########################################
- name: Set Application Expiration time
uri:
url: "https://cloud.ravellosystems.com/api/v1/applications/{{ app.json.id }}/setExpiration"
method: POST
status_code: 200
HEADER_Content-Type: 'application/json'
HEADER_Accept: 'application/json'
HEADER_X-Ephemeral-Token-Authorization: "{{ ravello_ci_token }}"
body: '{ "expirationFromNowSeconds": {{ ravello_ci_expiration_time_min * 60 }} }'
body_format: json
run_once: true
- name: Wait for devices to come up
pause: minutes=5
- name: Wait for devices to come up
pause: minutes=5
- name: Wait for devices to come up
pause: minutes=5
- name: Wait for devices to come up
pause: minutes=5
- name: Wait for devices to come up
pause: minutes=5
- name: Wait for devices to come up
pause: minutes=5
- name: Wait for devices to come up
pause: minutes=5