From d37c6b72c5a769c04fc98a32da0bac2571cb1dd1 Mon Sep 17 00:00:00 2001 From: Josh Meisels Date: Sun, 2 Apr 2017 09:34:09 -0700 Subject: [PATCH] Add new Azure regions and allow user to select VM size (#332) * Update Azure Region List Included several additional regions in the Azure list. In a future version we may want to ask users to choose a continent, then present region options since this list is getting long. * Add VM size selection Added prompt for user to choose VM size. Useful because the default size is not available in all regions, and there are cheaper sizes. * Handle vm_size choice in "Create an Instance" step Use the variable passed in that the user chose for vm_size. * Differentiate Basic A0 and Standard A0 * Remove vm_size D1 since it's being deprecated * Fix syntax issue - missing semicolons * Remove note to self comment * Remove changes to let user select VM size Removing my previous additions that let the user select their Azure VM size. * Hard code VM size to cheapest size Remove my usage of a variable for VM size. Update to use the Basic_A0, which is the cheapest size of VM. --- algo | 27 ++++++++++++++++++++++++++- roles/cloud-azure/tasks/main.yml | 4 +++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/algo b/algo index ecf33a1..b5d44f8 100755 --- a/algo +++ b/algo @@ -94,7 +94,7 @@ Name the vpn server: azure_server_name=${azure_server_name:-algo} read -p " - What region should the server be located in? + What region should the server be located in? (https://azure.microsoft.com/en-us/regions/) 1. South Central US 2. Central US 3. North Europe @@ -109,6 +109,19 @@ Name the vpn server: 12. West Central US 13. UK South 14. UK West + 15. West US + 16. Brazil South + 17. Canada Central + 18. Central India + 19. East Asia + 20. Germany Central + 21. Germany Northeast + 22. Korea Central + 23. Korea South + 24. North Central US + 25. South India + 26. West India + Enter the number of your desired region: [1]: " -r azure_region azure_region=${azure_region:-1} @@ -128,6 +141,18 @@ Enter the number of your desired region: 12) region="westcentralus" ;; 13) region="uksouth" ;; 14) region="ukwest" ;; + 15) region="westus" ;; + 16) region="brazilsouth" ;; + 17) region="canadacentral" ;; + 18) region="centralindia" ;; + 19) region="eastasia" ;; + 20) region="germanycentral" ;; + 21) region="germanynortheast" ;; + 22) region="koreacentral" ;; + 23) region="koreasouth" ;; + 24) region="northcentralus" ;; + 25) region="southindia" ;; + 26) region="westindia" ;; esac ROLES="azure vpn cloud" diff --git a/roles/cloud-azure/tasks/main.yml b/roles/cloud-azure/tasks/main.yml index dfdde2e..17c6ce3 100644 --- a/roles/cloud-azure/tasks/main.yml +++ b/roles/cloud-azure/tasks/main.yml @@ -80,7 +80,7 @@ virtual_network: algo_net name: "{{ azure_server_name }}" ssh_password_enabled: false - vm_size: Standard_D1 + vm_size: Basic_A0 tags: Environment: Algo ssh_public_keys: @@ -91,6 +91,8 @@ sku: '16.04-LTS' version: latest register: azure_rm_virtualmachine + + # To-do: Add error handling - if vm_size requested is not available, can we fall back to another, ideally with a prompt? - set_fact: ip_address: "{{ azure_rm_virtualmachine.ansible_facts.azure_vm.properties.networkProfile.networkInterfaces[0].properties.ipConfigurations[0].properties.publicIPAddress.properties.ipAddress }}"