From ea6aefc59ac0d12a7a6e847f5d3a548e0f9f664c Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 07:08:05 +0800 Subject: [PATCH 01/15] first --- appgateway_create.yml | 67 ++++++++++++++++++++++--------------------- files/cert1.txt | 1 + files/cert2.txt | 1 + 3 files changed, 36 insertions(+), 33 deletions(-) create mode 100644 files/cert1.txt create mode 100644 files/cert2.txt diff --git a/appgateway_create.yml b/appgateway_create.yml index 1707acb..ef4c7fd 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -9,23 +9,15 @@ --- - hosts: localhost + vars: + resource_group: zimsappgwrgXXX + location: eastus tasks: - - name: Prepare random postfix + - name: Prepare random number set_fact: - rpfx: "{{ 1000 | random }}" + rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" run_once: yes -- hosts: localhost - roles: - - Azure.azure_preview_modules - vars: - resource_group: "{{ resource_group_name }}" - location: eastus - vnet_name: ansiblevnetname - subnet_name: ansiblesubnetname - appgw_name: appgw{{ rpfx }} - azure_subscription_id: "{{ lookup('env','AZURE_SUBSCRIPTION_ID') }}" - tasks: - name: Create a resource group azure_rm_resourcegroup: name: "{{ resource_group }}" @@ -75,7 +67,7 @@ - name: Create a virtual network azure_rm_virtualnetwork: - name: "{{ vnet_name }}" + name: vnet{{ rpfx }} resource_group: "{{ resource_group }}" address_prefixes_cidr: - 10.1.0.0/16 @@ -86,46 +78,49 @@ - name: Create a subnet azure_rm_subnet: - name: "{{ subnet_name }}" - virtual_network_name: "{{ vnet_name }}" + name: subnet{{ rpfx }} + virtual_network_name: vnet{{ rpfx }} resource_group: "{{ resource_group }}" address_prefix_cidr: 10.1.0.0/24 register: subnet_output - - name: Create a public IP address - azure_rm_publicipaddress: - resource_group: "{{ resource_group }}" - allocation_method: Dynamic - name: appgwpublicip - domain_name_label: "{{ resource_group }}" - register: pip_output - - - name: Dump Public IP output - debug: - var: pip_output - name: Create instance of Application Gateway - azure_rm_appgw: + azure_rm_appgateway: resource_group: "{{ resource_group }}" - name: "{{ appgw_name }}" + name: "appgateway{{ rpfx }}" sku: name: standard_small tier: standard capacity: 2 + ssl_policy: + policy_type: predefined + policy_name: ssl_policy20150501 + disabled_ssl_protocols: + - tls_v1_0 + cipher_suites: + - tls_ecdhe_ecdsa_with_aes_256_gcm_sha384 + authentication_certificates: + - name: cert1 + data: "{{ lookup('file', 'cert1.txt') }}" + ssl_certificates: + - name: cert2 + password: your-password + data: "{{ lookup('file', 'cert2.txt') }}" gateway_ip_configurations: - subnet: id: "{{ subnet_output.state.id }}" name: app_gateway_ip_config frontend_ip_configurations: - - public_ip_address: appgwpublicip + - subnet: + id: "{{ subnet_output.state.id }}" name: sample_gateway_frontend_ip_config frontend_ports: - - port: 80 + - port: 90 name: ag_frontend_port backend_address_pools: - backend_addresses: - - ip_address: "{{ ci_output_a.ip_address }}" - - ip_address: "{{ ci_output_b.ip_address }}" + - ip_address: 10.0.0.4 name: test_backend_address_pool backend_http_settings_collection: - port: 80 @@ -143,3 +138,9 @@ http_listener: sample_http_listener name: rule1 register: output + + - name: Assert the resource instance is well created + assert: + that: + - output.changed + diff --git a/files/cert1.txt b/files/cert1.txt new file mode 100644 index 0000000..82a13f4 --- /dev/null +++ b/files/cert1.txt @@ -0,0 +1 @@ +MIIMAjCCCeqgAwIBAgITLQAAMpnXBx230XCKQgAAAAAymTANBgkqhkiG9w0BAQsFADCBizELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEVMBMGA1UECxMMTWljcm9zb2Z0IElUMR4wHAYDVQQDExVNaWNyb3NvZnQgSVQgVExTIENBIDUwHhcNMTcwNzIwMTc0NzA4WhcNMTkwNzEwMTc0NzA4WjAXMRUwEwYDVQQDEwx3d3cuYmluZy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBA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GcKTmDBjE8cqv5IA/jQ6gtaxCI5pDxfXK4ct7oQyoChfxOXcEDKMmMndFmg9ch5c4an/FRM2cgzDfjR01A71LNUpLUdOjNV0T+ZEStqEpdyDFfjrHGDtzLyqEz3iyvvQFyjmlGh6OtZXwjCPpnVSrKCmfJKio0kUxyq+6t5tZAQbPVgFKiMrVnU+sgvmNVip1toijyz8vMVCkwJ2G++7xjJukoELMxZ50W4/SAMZLy1Asx02NBwYCu9+CTQPVnmPe7rmxhlQRBOfDNa1+5jwRHY64YudEzKhWR1uqS3ABd/fk+TL86yuNYGAgxnOm1FtOGieRgViV3+NzC+bDbuUOtmbD/GvDGmRwJRcCTHL7jBmkHePh2ABY93NE/IbkaDP6l1Kw98AfqkzSUxhqHXuThe7KIoX9/0zv4AA1WZFis1QvAG7dpl9eio6vCdC/73HvBAlqRL+7Mb1uu0 diff --git a/files/cert2.txt b/files/cert2.txt new file mode 100644 index 0000000..a539dbc --- /dev/null +++ b/files/cert2.txt @@ -0,0 +1 @@ +MIIKsQIBAzCCCm0GCSqGSIb3DQEHAaCCCl4EggpaMIIKVjCCBg8GCSqGSIb3DQEHAaCCBgAEggX8MIIF+DCCBfQGCyqGSIb3DQEMCgECoIIE/jCCBPowHAYKKoZIhvcNAQwBAzAOBAj37r+wRsc6/gICB9AEggTY1V5HNscO+2bZb7JSMme1ljERe7DCiRE2cJsPKlwW2/NEiSqAUX7gXKK0ISr6Dto71rFdza0uPwbcQoPN1QwkJHSAkxWg4OcAx2kf7077tlHhf5rzxTn5V3wXM0Q3h6NsDjSqSHjYVISIiXItUzlDaBpMY/NUFNCTyJR5I91MWsljrJ/bQaAIo57HJR9nzjY5DaBA9P3bAhmX5LJRGsJWoCEaGeeVQ3Yn6yD06ordiJnf6dNxqQGN+o2x54gqfmw+RnoC2f8VAsTIfb3fwJPKdg2JiJIa6Ms2Sc8VR7VGmZt34qZwTPBrzeqJjtIMT41bBae46lmma8ypYwErqzOYSrHqXPXzaxlloYy81HYWAsJTWyB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nu64zPgE6ALe9yJOT8AFEB6H1c16Z+aPGj9hbhkh6tcdGWUvzDYq08wjKjP3nA78StIisUmeZPfAXJUquPzRZr0pmcwYWfyP54TdC2BvPlLW/QXVV44IGxUdLuI6mz4p+O2+xKu9QMFwdcpij2ZK4uMrBLDo7ZoTQ4rBRnn471AMUKgeP0D5tbl8PygUU1RqHv34ok3fwx0WglzdMQJyt53PiPWW4lipwUtUfd0eD8CXoMccf8XJmugVUBCD1wQsyCW6RrR9RX8HXVBrm5O2HKfJcQYznl3qHqXb6ofvbOQ3S+v0ALN+sma8Tn6JceVTAOH+UuMdcu0FIDYnpmrvMecnJ2kbs1Y35mj4rSJyP5PGLg+ygb9VlBPwCCem/jHL+YivN38+0oWqfn2slyI4FNKX+5U8M6xpiEaq6McKwKZC1d51A4dUdMAkO2d1Z6rVjqhKeqE6HWD9A0cyPBFZpNQskUfNDW8qILLEfEjhBi+s1LkHzKDykCN/ReFfRiQS84DekoC59cymM8Hs1geMWCMFWfut4HTd7ItYaiJz5qpYVY4U/8myhyWnrktjLjQ6OkdM9bBDIpRHj95MYEC26NlWQZwjk+yynPTZf0w5p2Ok6Dq2shJFykuJ1VkelgvsPe8qMa55Wp11dpREIFzXouPXNP/vFpziZcl1OKTd7Dwa+ruQFRfsoZGzupsBOYxrmYqr6kOm5mzMW0HAlsWwl5mY2aSQMvXBE6k32xTkPIlIp763Ee4m6cmx4+SDcO5D+a9t05QY4JmssL+x3T9qsbXSXDPEsg0cfVvuQYy9AYkIFOes4G45IagRAvhQQj9bEh8kTvp8CFDDtIrbWjX50zreb51VcAcEkIOLyROtIdLem0zA7MB8wBwYFKw4DAhoEFC0i4I5iwNYQug0vTVS0JC/Qm+/NBBTsUM0D9QxIZYUi+qlDy14sOcEaUwICB9A= From b74ab14abf1fa4d5c8ffc825f06a12f0c392fa14 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 07:47:51 +0800 Subject: [PATCH 02/15] next iteration --- appgateway_create.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index ef4c7fd..6881463 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -11,9 +11,13 @@ - hosts: localhost vars: resource_group: zimsappgwrgXXX - location: eastus + location: eastus + vnet_name: ansiblevnetname + subnet_name: ansiblesubnetname + appgateway_name: appgw{{ rpfx }} + azure_subscription_id: "{{ lookup('env','AZURE_SUBSCRIPTION_ID') }}" tasks: - - name: Prepare random number + - name: Prepare random postfix set_fact: rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" run_once: yes @@ -67,7 +71,7 @@ - name: Create a virtual network azure_rm_virtualnetwork: - name: vnet{{ rpfx }} + name: "{{ vnet_name }}" resource_group: "{{ resource_group }}" address_prefixes_cidr: - 10.1.0.0/16 @@ -78,8 +82,8 @@ - name: Create a subnet azure_rm_subnet: - name: subnet{{ rpfx }} - virtual_network_name: vnet{{ rpfx }} + name: "{{ subnet_name }}" + virtual_network_name: "{{ vnet_name }}" resource_group: "{{ resource_group }}" address_prefix_cidr: 10.1.0.0/24 register: subnet_output @@ -88,7 +92,7 @@ - name: Create instance of Application Gateway azure_rm_appgateway: resource_group: "{{ resource_group }}" - name: "appgateway{{ rpfx }}" + name: "{{ appgateway_name }}" sku: name: standard_small tier: standard From 8c80ddecfc19c46da8fd70ed211e15fdbfae0123 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 08:15:15 +0800 Subject: [PATCH 03/15] fixed ip address --- appgateway_create.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index 6881463..41b88c4 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -124,7 +124,8 @@ name: ag_frontend_port backend_address_pools: - backend_addresses: - - ip_address: 10.0.0.4 + - ip_address: "{{ ci_output_a.ip_address }}" + - ip_address: "{{ ci_output_b.ip_address }}" name: test_backend_address_pool backend_http_settings_collection: - port: 80 From 62686ba5f01e8e929144a65b0abc38dcf5f74e01 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 08:16:15 +0800 Subject: [PATCH 04/15] removed last assert --- appgateway_create.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index 41b88c4..d27fb67 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -144,8 +144,3 @@ name: rule1 register: output - - name: Assert the resource instance is well created - assert: - that: - - output.changed - From c26878805e5e3d72e037714d2b60e3c8cb4e4d43 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 08:18:56 +0800 Subject: [PATCH 05/15] minor --- appgateway_create.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index d27fb67..407dabc 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -10,12 +10,11 @@ --- - hosts: localhost vars: - resource_group: zimsappgwrgXXX + resource_group: "{{ resource_group_name }}" location: eastus vnet_name: ansiblevnetname subnet_name: ansiblesubnetname appgateway_name: appgw{{ rpfx }} - azure_subscription_id: "{{ lookup('env','AZURE_SUBSCRIPTION_ID') }}" tasks: - name: Prepare random postfix set_fact: From 86070428c79236f28f0dab2d179e88ba7c0e0d26 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 08:21:26 +0800 Subject: [PATCH 06/15] postfix in the front --- appgateway_create.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index 407dabc..cdc80a1 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -8,6 +8,14 @@ # 1. create application gateway --- + +- hosts: localhost + tasks: + - name: Prepare random postfix + set_fact: + rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + run_once: yes + - hosts: localhost vars: resource_group: "{{ resource_group_name }}" @@ -15,11 +23,6 @@ vnet_name: ansiblevnetname subnet_name: ansiblesubnetname appgateway_name: appgw{{ rpfx }} - tasks: - - name: Prepare random postfix - set_fact: - rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" - run_once: yes - name: Create a resource group azure_rm_resourcegroup: From c26a9562afbdbd682b95cc2d11fd0b03cc77dae8 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 08:28:26 +0800 Subject: [PATCH 07/15] readded public ip --- appgateway_create.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index cdc80a1..4f82c62 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -13,17 +13,17 @@ tasks: - name: Prepare random postfix set_fact: - rpfx: "{{ resource_group | hash('md5') | truncate(7, True, '') }}{{ 1000 | random }}" + rpfx: "{{ 'zimsappgwrg' | truncate(7, True, '') }}{{ 1000 | random }}" run_once: yes - hosts: localhost vars: - resource_group: "{{ resource_group_name }}" + resource_group: zimsappgwrg location: eastus vnet_name: ansiblevnetname subnet_name: ansiblesubnetname - appgateway_name: appgw{{ rpfx }} - + appgateway_name: zimsappgw + tasks: - name: Create a resource group azure_rm_resourcegroup: name: "{{ resource_group }}" @@ -90,6 +90,17 @@ address_prefix_cidr: 10.1.0.0/24 register: subnet_output + - name: Create a public IP address + azure_rm_publicipaddress: + resource_group: "{{ resource_group }}" + allocation_method: Dynamic + name: appgwpublicip + domain_name_label: "{{ resource_group }}" + register: pip_output + + - name: Dump Public IP output + debug: + var: pip_output - name: Create instance of Application Gateway azure_rm_appgateway: From 1961020376bf67e7c9417054b6e3ab6bcb11cf85 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 09:43:49 +0800 Subject: [PATCH 08/15] changed subnet to public ip --- appgateway_create.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index 4f82c62..b931cb0 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -18,7 +18,7 @@ - hosts: localhost vars: - resource_group: zimsappgwrg + resource_group: zimsappgwrgxx location: eastus vnet_name: ansiblevnetname subnet_name: ansiblesubnetname @@ -98,6 +98,12 @@ domain_name_label: "{{ resource_group }}" register: pip_output + - name: Create a public IP address + azure_rm_publicipaddress_facts: + resource_group: "{{ resource_group }}" + name: appgwpublicip + register: pip_output + - name: Dump Public IP output debug: var: pip_output @@ -129,8 +135,7 @@ id: "{{ subnet_output.state.id }}" name: app_gateway_ip_config frontend_ip_configurations: - - subnet: - id: "{{ subnet_output.state.id }}" + - public_ip_address: appgwpublicip name: sample_gateway_frontend_ip_config frontend_ports: - port: 90 From 4be184f8f62d909a08024350146d1a2b170963c4 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 09:45:38 +0800 Subject: [PATCH 09/15] removed space --- appgateway_create.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index b931cb0..e2f18ef 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -135,7 +135,7 @@ id: "{{ subnet_output.state.id }}" name: app_gateway_ip_config frontend_ip_configurations: - - public_ip_address: appgwpublicip + - public_ip_address: appgwpublicip name: sample_gateway_frontend_ip_config frontend_ports: - port: 90 From c73af7f8f493a88cae01c23cb146f02827da8c94 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 09:47:44 +0800 Subject: [PATCH 10/15] removed querying public ip facts --- appgateway_create.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index e2f18ef..86732a5 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -98,12 +98,6 @@ domain_name_label: "{{ resource_group }}" register: pip_output - - name: Create a public IP address - azure_rm_publicipaddress_facts: - resource_group: "{{ resource_group }}" - name: appgwpublicip - register: pip_output - - name: Dump Public IP output debug: var: pip_output From e2357c5ea6fd6beaad44216fe7cbb6f081f1bb40 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 09:48:57 +0800 Subject: [PATCH 11/15] appgw name --- appgateway_create.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index 86732a5..a7dc39f 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -22,7 +22,7 @@ location: eastus vnet_name: ansiblevnetname subnet_name: ansiblesubnetname - appgateway_name: zimsappgw + appgw_name: zimsappgw tasks: - name: Create a resource group azure_rm_resourcegroup: @@ -105,7 +105,7 @@ - name: Create instance of Application Gateway azure_rm_appgateway: resource_group: "{{ resource_group }}" - name: "{{ appgateway_name }}" + name: "{{ appgw_name }}" sku: name: standard_small tier: standard From a3a7493dc5bb67026116c8c635bf85ede70f9cf5 Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 19 Sep 2018 21:07:55 +0800 Subject: [PATCH 12/15] small fixes --- appgateway_create.yml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index a7dc39f..8693c90 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -1,28 +1,23 @@ # Description # =========== -# This playbook creates an Application Gateway, the azure_rm_appgw module is not available in v2.4 & 2.5, but in azure_preview_modules role, +# This playbook creates an Application Gateway, the azure_rm_appgateway module is not available in v2.4 & 2.5, but in azure_preview_modules role, # so you need to run "ansible-galaxy install Azure.azure_preview_modules" to install the role to get lastest Ansible modules. # 1. create resource group +# 1. create two container instances with httpd running # 1. create virtual network # 1. create subnet # 1. create application gateway --- -- hosts: localhost - tasks: - - name: Prepare random postfix - set_fact: - rpfx: "{{ 'zimsappgwrg' | truncate(7, True, '') }}{{ 1000 | random }}" - run_once: yes - - hosts: localhost vars: - resource_group: zimsappgwrgxx + resource_group: zimsappgwnew location: eastus vnet_name: ansiblevnetname subnet_name: ansiblesubnetname appgw_name: zimsappgw + tasks: - name: Create a resource group azure_rm_resourcegroup: @@ -63,14 +58,6 @@ - 80 register: ci_output_b - - name: Dump first container instance output - debug: - var: ci_output_a - - - name: Dump second container instance output - debug: - var: ci_output_b - - name: Create a virtual network azure_rm_virtualnetwork: name: "{{ vnet_name }}" @@ -148,11 +135,11 @@ - frontend_ip_configuration: sample_gateway_frontend_ip_config frontend_port: ag_frontend_port name: sample_http_listener + protocol: https + ssl_certificate: cert2 request_routing_rules: - rule_type: Basic backend_address_pool: test_backend_address_pool backend_http_settings: sample_appgateway_http_settings http_listener: sample_http_listener name: rule1 - register: output - From bd35a9e2ff1e4e620797cb197428c521fbf68dcb Mon Sep 17 00:00:00 2001 From: zikalino Date: Fri, 21 Sep 2018 12:30:24 +0800 Subject: [PATCH 13/15] added app gateway to ignore, as currently no proper version in preview modules --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8372c82..8f599fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,7 +52,7 @@ before_install: diffstr=$(git diff $branch remotes/origin/master --name-only -- '*.yml' --no-pager); changedfiles=($diffstr); - excludedList="vm_create_existingvnet_deployjavaapp.yml .travis.yml aks_create_scale.yml webapp.yml rest/sql-managed-instance.yml vm_create_image.yml"; + excludedList="vm_create_existingvnet_deployjavaapp.yml .travis.yml aks_create_scale.yml webapp.yml rest/sql-managed-instance.yml vm_create_image.yml appgateway_create.yml"; echo start = $start, end = $end, list_lenth = ${#changedfiles[@]}; From ab10a247f235bb1f650f7d03f8afc6438bfd11f4 Mon Sep 17 00:00:00 2001 From: zikalino Date: Mon, 24 Sep 2018 04:54:56 +0800 Subject: [PATCH 14/15] simplyfying appgateway sample --- appgateway_create.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/appgateway_create.yml b/appgateway_create.yml index 5f0394c..8179648 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -100,20 +100,6 @@ name: standard_small tier: standard capacity: 2 - ssl_policy: - policy_type: predefined - policy_name: ssl_policy20150501 - disabled_ssl_protocols: - - tls_v1_0 - cipher_suites: - - tls_ecdhe_ecdsa_with_aes_256_gcm_sha384 - authentication_certificates: - - name: cert1 - data: "{{ lookup('file', 'cert1.txt') }}" - ssl_certificates: - - name: cert2 - password: your-password - data: "{{ lookup('file', 'cert2.txt') }}" gateway_ip_configurations: - subnet: id: "{{ subnet_output.state.id }}" @@ -122,7 +108,7 @@ - public_ip_address: appgwpublicip name: sample_gateway_frontend_ip_config frontend_ports: - - port: 90 + - port: 80 name: ag_frontend_port backend_address_pools: - backend_addresses: @@ -138,8 +124,7 @@ - frontend_ip_configuration: sample_gateway_frontend_ip_config frontend_port: ag_frontend_port name: sample_http_listener - protocol: https - ssl_certificate: cert2 + protocol: http request_routing_rules: - rule_type: Basic backend_address_pool: test_backend_address_pool From 016900ce278b5a94b2b4e56e4dfe1eafb6b2948a Mon Sep 17 00:00:00 2001 From: zikalino Date: Wed, 26 Sep 2018 04:41:55 +0800 Subject: [PATCH 15/15] resource group name + remove from ignore --- .travis.yml | 2 +- appgateway_create.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f599fa..8372c82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,7 +52,7 @@ before_install: diffstr=$(git diff $branch remotes/origin/master --name-only -- '*.yml' --no-pager); changedfiles=($diffstr); - excludedList="vm_create_existingvnet_deployjavaapp.yml .travis.yml aks_create_scale.yml webapp.yml rest/sql-managed-instance.yml vm_create_image.yml appgateway_create.yml"; + excludedList="vm_create_existingvnet_deployjavaapp.yml .travis.yml aks_create_scale.yml webapp.yml rest/sql-managed-instance.yml vm_create_image.yml"; echo start = $start, end = $end, list_lenth = ${#changedfiles[@]}; diff --git a/appgateway_create.yml b/appgateway_create.yml index 8179648..a2fe6a3 100644 --- a/appgateway_create.yml +++ b/appgateway_create.yml @@ -15,7 +15,7 @@ roles: - Azure.azure_preview_modules vars: - resource_group: zimsappgwnew + resource_group: "{{ resource_group_name }}" location: eastus vnet_name: ansiblevnetname subnet_name: ansiblesubnetname