Created
March 8, 2016 21:03
-
-
Save webframp/fa67270fde530d86f2bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Single compute node in a basic network. | |
| # lots of hardcoded stuff so a bad example, but functional | |
| SparkleFormation.new(:azure_compute, :provider => :azure) do | |
| set!('$schema', 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#') | |
| content_version '1.0.0.0' | |
| parameters do | |
| sparkle_image_id do | |
| type 'string' | |
| default_value '14.04.2-LTS' | |
| end | |
| sparkle_flavor do | |
| type 'string' | |
| allowed_values [ | |
| 'Standard_D1' | |
| ] | |
| end | |
| storage_account_name do | |
| type 'string' | |
| default_value 'miasmatesting' | |
| end | |
| storage_container_name do | |
| type 'string' | |
| default_value 'miasma-orchestration-templates' | |
| end | |
| subnet_id.type 'string' | |
| end | |
| dynamic!(:network_public_ip_addresses, :sparkle) do | |
| properties do | |
| set!('publicIPAllocationMethod', 'Dynamic') | |
| dns_settings.domain_name_label 'sparkle' | |
| end | |
| end | |
| dynamic!(:network_interfaces, :sparkle) do | |
| properties.ip_configurations array!( | |
| ->{ | |
| name 'ipconfig1' | |
| properties do | |
| set!('privateIPAllocationMethod', 'Dynamic') | |
| set!('publicIPAddress').id resource_id!(:sparkle_network_public_ip_addresses) | |
| subnet.id parameters!(:subnet_id) | |
| end | |
| } | |
| ) | |
| end | |
| dynamic!(:compute_virtual_machines, :sparkle) do | |
| depends_on!(:sparkle_network_interfaces) | |
| properties do | |
| hardware_profile.vm_size parameters!(:sparkle_flavor) | |
| os_profile do | |
| computer_name 'sparkle' | |
| admin_username 'sparkle' | |
| admin_password 'SparkleFormation2016' | |
| end | |
| storage_profile do | |
| image_reference do | |
| publisher 'Canonical' | |
| offer 'UbuntuServer' | |
| sku parameters!(:sparkle_image_id) | |
| version 'latest' | |
| end | |
| os_disk do | |
| name 'osdisk' | |
| vhd.uri concat!('http://', parameters!(:storage_account_name), '.blob.core.windows.net/', parameters!(:storage_container_name), '/sparkle.vhd') | |
| caching 'ReadWrite' | |
| create_option 'FromImage' | |
| end | |
| data_disks array!( | |
| ->{ | |
| name 'datadisk1' | |
| set!('diskSizeGB', 100) | |
| lun 0 | |
| vhd.uri concat!('http://', parameters!(:storage_account_name), '.blob.core.windows.net/', parameters!(:storage_container_name), '/sparkle-data.vhd') | |
| create_option 'Empty' | |
| } | |
| ) | |
| end | |
| network_profile.network_interfaces array!( | |
| ->{ id resource_id!(:sparkle_network_interfaces) } | |
| ) | |
| end | |
| end | |
| outputs.sparkle_public_address do | |
| type 'string' | |
| value reference!(:sparkle_network_public_ip_addresses).ipAddress | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SparkleFormation.new(:az_net, :provider => :azure) do | |
| set!('$schema', 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#') | |
| content_version '1.0.0.0' | |
| parameters do | |
| address_prefix do | |
| type 'string' | |
| default_value '10.0.0.0/16' | |
| end | |
| subnet_prefix do | |
| type 'string' | |
| default_value '10.0.0.0/24' | |
| end | |
| security_group_id.type 'string' | |
| end | |
| dynamic!(:virtual_networks, :test) do | |
| properties do | |
| address_space.address_prefixes [parameters!(:address_prefix)] | |
| subnets array!( | |
| ->{ | |
| name 'sparkle-subnet' | |
| properties do | |
| address_prefix parameters!(:subnet_prefix) | |
| network_security_group.id parameters!(:security_group_id) | |
| end | |
| } | |
| ) | |
| end | |
| end | |
| outputs do | |
| subnet_id do | |
| type :string | |
| value concat!(resource_id!(:test_virtual_networks), '/subnets/sparkle-subnet') | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SparkleFormation.new(:az_root, :provider => :azure) do | |
| set!('$schema', 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#') | |
| content_version '1.0.0.0' | |
| nest!(:az_sec) do | |
| api_version "2015-01-01" | |
| end | |
| nest!(:az_net) do | |
| api_version "2015-01-01" | |
| end | |
| nest!(:az_compute) do | |
| api_version "2015-01-01" | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SparkleFormation.new(:az_sec, :provider => :azure) do | |
| set!('$schema', 'https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#') | |
| content_version '1.0.0.0' | |
| # parameters.location do | |
| # type 'string' | |
| # default_value 'westus' | |
| # end | |
| # variables.api_version '2015-06-15' | |
| dynamic!(:network_security_groups, :test) do | |
| #api_version variables!(:api_version) | |
| #location parameters!(:location) | |
| location resource_group!.location | |
| properties.security_rules array!( | |
| ->{ | |
| name 'first_rule' | |
| properties do | |
| description 'First Rule' | |
| protocol 'Tcp' | |
| source_port_range '23-45' | |
| destination_port_range '46-56' | |
| source_address_prefix '*' | |
| destination_address_prefix '*' | |
| access 'Allow' | |
| priority 123 | |
| direction 'Inbound' | |
| end | |
| } | |
| ) | |
| end | |
| outputs.security_group_id do | |
| value resource_id!(:test_network_security_groups) | |
| type 'string' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment