-
Notifications
You must be signed in to change notification settings - Fork 350
/
webapp.yml
92 lines (82 loc) · 2.79 KB
/
webapp.yml
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
# Description
# ===========
# This playbook creates
# - An Azure Linux Web app with Java container Tomcat 8.5.
# - An Azure Traffic manager profile.
# - Add the web site created as an endpoint of the Traffic Manager Profile.
#
# This playbook requires Ansible version >=2.7, or you could use role azure.azure_preview_modules
# If you're using Ansible >=2.7, just remove the role lines.
- hosts: localhost
connection: local
vars:
app_name: myTestApp
location: eastus
linux_plan_name: myTestPlan
traffic_manager_profile_name: myTMProfile
traffic_manager_endpoint_name: endpoint1
roles:
- azure.azure_preview_modules
tasks:
- name: Create resource group
azure_rm_resourcegroup:
name: "{{ resource_group_name }}"
location: "{{ location }}"
- name: Create resource group for app service plan
azure_rm_resourcegroup:
name: "{{ resource_group_name }}2nd"
location: "{{ location }}"
- name: Create App Service Plan
azure_rm_appserviceplan:
resource_group: "{{ resource_group_name }}2nd"
name: "{{ linux_plan_name }}"
location: "{{ location }}"
is_linux: true
sku: S1
number_of_workers: 1
- name: Create a Linux web app with Java framework and Tomcat
azure_rm_webapp:
resource_group: "{{ resource_group_name }}"
name: "{{ app_name }}"
plan:
resource_group: "{{ resource_group_name }}2nd"
name: "{{ linux_plan_name }}"
app_settings:
testkey: "testvalue"
frameworks:
- name: java
version: 8
settings:
java_container: "Tomcat"
java_container_version: "8.5"
- name: Get web app facts
azure_rm_webapp_facts:
resource_group: "{{ resource_group_name }}"
name: "{{ app_name }}"
return_publish_profile: true
register: webapp
- name: Create Traffic Manager Profile
azure_rm_trafficmanagerprofile:
resource_group: "{{ resource_group_name }}"
name: "{{ traffic_manager_profile_name }}"
location: global
routing_method: performance
dns_config:
relative_name: "{{ traffic_manager_profile_name }}"
ttl: 60
monitor_config:
protocol: HTTPS
port: 80
path: '/'
- name: Add endpoint to traffic manager profile, using the web site created above
azure_rm_trafficmanagerendpoint:
resource_group: "{{ resource_group_name }}"
profile_name: "{{ traffic_manager_profile_name }}"
name: "{{ traffic_manager_endpoint_name }}"
type: azure_endpoints
location: "{{ location }}"
target_resource_id: "{{ webapp.webapps[0].id }}"
- name: Get Traffic Manager Profile facts
azure_rm_trafficmanagerprofile_facts:
resource_group: "{{ resource_group_name }}"
name: "{{ traffic_manager_profile_name }}"