Skip to content

Commit 31bde4a

Browse files
authored
1 parent 946dc2b commit 31bde4a

File tree

3 files changed

+99
-1
lines changed

3 files changed

+99
-1
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ before_install:
5252

5353
diffstr=$(git diff $branch remotes/origin/master --name-only -- '*.yml' --no-pager);
5454
changedfiles=($diffstr);
55-
excludedList="vm_create_existingvnet_deployjavaapp.yml .travis.yml aks_create_scale.yml";
55+
excludedList="vm_create_existingvnet_deployjavaapp.yml .travis.yml aks_create_scale.yml webapp.yml";
5656

5757
echo start = $start, end = $end, list_lenth = ${#changedfiles[@]};
5858

__helpers/__delete_test_resource_group.yml

+6
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,9 @@
1111
name: "{{ resource_group_name }}"
1212
force: True
1313
state: absent
14+
15+
- name: delete second resource group
16+
azure_rm_resourcegroup:
17+
name: "{{ resource_group_name }}2nd"
18+
force: True
19+
state: absent

webapp.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Description
2+
# ===========
3+
# This playbook creates
4+
# - An Azure Linux Web app with Java container Tomcat 8.5.
5+
# - An Azure Traffic manager profile.
6+
# - Add the web site created as an endpoint of the Traffic Manager Profile.
7+
#
8+
# This playbook requires Ansible version >=2.7, or you could use role Azure.azure_preview_modules
9+
# If you're using Ansible >=2.7, just remove the role lines.
10+
11+
- hosts: localhost
12+
connection: local
13+
vars:
14+
app_name: testapp0917
15+
location: eastus
16+
linux_plan_name: testplan0917
17+
traffic_manager_profile_name: profile0917
18+
traffic_manager_endpoint_name: endpoint1
19+
20+
roles:
21+
- Azure.azure_preview_modules
22+
23+
tasks:
24+
- name: Create resource group
25+
azure_rm_resourcegroup:
26+
name: "{{ resource_group_name }}"
27+
location: "{{ location }}"
28+
29+
- name: Create resource group for app service plan
30+
azure_rm_resourcegroup:
31+
name: "{{ resource_group_name }}2nd"
32+
location: "{{ location }}"
33+
34+
- name: Create App Service Plan
35+
azure_rm_appserviceplan:
36+
resource_group: "{{ resource_group_name }}2nd"
37+
name: "{{ linux_plan_name }}"
38+
location: "{{ location }}"
39+
is_linux: true
40+
sku: S1
41+
number_of_workers: 1
42+
43+
- name: Create a Linux web app with Java framework and Tomcat
44+
azure_rm_webapp:
45+
resource_group: "{{ resource_group_name }}"
46+
name: "{{ app_name }}"
47+
plan:
48+
resource_group: "{{ resource_group_name }}2nd"
49+
name: "{{ linux_plan_name }}"
50+
app_settings:
51+
testkey: "testvalue"
52+
frameworks:
53+
- name: java
54+
version: 8
55+
settings:
56+
java_container: "Tomcat"
57+
java_container_version: "8.5"
58+
59+
- name: Get web app facts
60+
azure_rm_webapp_facts:
61+
resource_group: "{{ resource_group_name }}"
62+
name: "{{ app_name }}"
63+
return_publish_profile: true
64+
register: webapp
65+
66+
- name: Create Traffic Manager Profile
67+
azure_rm_trafficmanagerprofile:
68+
resource_group: "{{ resource_group_name }}"
69+
name: "{{ traffic_manager_profile_name }}"
70+
location: global
71+
routing_method: performance
72+
dns_config:
73+
relative_name: "{{ traffic_manager_profile_name }}"
74+
ttl: 60
75+
monitor_config:
76+
protocol: HTTPS
77+
port: 80
78+
path: '/'
79+
80+
- name: Add endpoint to traffic manager profile, using the web site created above
81+
azure_rm_trafficmanagerendpoint:
82+
resource_group: "{{ resource_group_name }}"
83+
profile_name: "{{ traffic_manager_profile_name }}"
84+
name: "{{ traffic_manager_endpoint_name }}"
85+
type: azure_endpoints
86+
location: "{{ location }}"
87+
target_resource_id: "{{ webapp.webapps[0].id }}"
88+
89+
- name: Get Traffic Manager Profile facts
90+
azure_rm_trafficmanagerprofile_facts:
91+
resource_group: "{{ resource_group_name }}"
92+
name: "{{ traffic_manager_profile_name }}"

0 commit comments

Comments
 (0)