---
cfgs:
  azure:
    __log__: properties.instanceView.bootDiagnostics.serialConsoleLogBlobUri
    __id__: id

azure_storage_account:
  topology:
    topology_name: azure_storage_account
    resource_groups:
      - resource_group_name: "azure_storage_account"
        resource_group_type: "azure"
        resource_definitions:
          - role: "azure_storage_account"
            resource_group: "ccit"
            name: "{{ distro }}storageaccount"
            account_type: Standard_LRS
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

# azure_api:
#   topology:
#     topology_name: azure_api
#     resource_groups:
#       - resource_group_name: "azure_api"
#         resource_group_type: "azure"
#         resource_definitions:
#           - role: "azure_api"
#             resource_group: ccit
#             body_path: {{body_path}}
#             #You can specify the name and path of body.json
#             url: "https://management.azure.com/subscriptions/{{subscriptionid}}/resourceGroups/{{resourcegroupname}}/providers/Microsoft.{{providers}}/virtualMachines/{{vmname}}?api-version=2019-03-01"
#         credentials:
#           filename: azure.key
#           profile: "{{ profile | default('key') }}"

azure_vm_public_image:
  topology:
    topology_name: azure_vm_public_image
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - vm_name: "{{ distro }}-TEST-Azure"
            role: azure_vm
            resource_group: ccit
            vm_size: "Standard_DS1_v2"
            public_image:
              offer: CentOS
              publisher: OpenLogic
              sku: '7.1'
              version: latest
            vm_username: linchpin
            vm_password: IloveLinchpin!
            deepclean: True
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"
  layout:
    inventory_layout:
      vars:
        hostname: __IP__
      hosts:
        example-node:
          count: 1
          host_groups:
            - example

azure_vn:
  topology:
    topology_name: azure_vn
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - virtual_network_name: "{{ distro }}-forLinchpinautomation"
            role: azure_virtual_network
            resource_group: ccit
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

azure_res_group:
  topology:
    topology_name: azure_res_group
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - role: azure_resource_group
            resource_group_name: "{{ distro }}-LinchpinCreatedGroup"
            location: centralus
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

azure_nic:
  topology:
    topology_name: azure_nic
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - virtual_network_name: "{{ distro }}-forLinchpinautomation"
            role: azure_network_interface
            resource_group: ccit
            subnet_name: "{{ distro }}-linchpincreated"
            network_interface_name: "{{ distro }}-forLinchpinautomation"
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

azure_vn_subnet:
  topology:
    topology_name: azure_vn
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - virtual_network_name: "{{ distro }}-forLinchpinautomation"
            subnet_name: "{{ distro }}-linchpincreated"
            role: azure_virtual_subnet
            address_prefix: '10.1.0.0/24'
            resource_group: ccit
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

azure_vm:
  topology:
    topology_name: azure_vm
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - vm_name: "{{ distro }}-TestAzureAuto"
            resource_group: ccit
            role: azure_vm
# This part below is not required, but you can still specify it
            vm_size: "Standard_DS1_v2"
            #availability_set: '{{ distro }}-LinchpinCreatedAVSet'
            private_image: "TestingImageAzure"
            # If you have both private and public images
            # Linchpin will take the private one
            # network_interface_names:
            #   yourresourcegroupname: nic_name
            public_image:
              offer: CentOS
              publisher: OpenLogic
              sku: '7.1'
              version: latest
              # If you don't specify the username and password
              # The default is as below
              # vm_username: linchpin&&&vm_password: IloveLinchpin!
            vm_username: linchpin 
            vm_password: IloveLinchpin!
            #you can also use public-key-authentication by below
            #public_key: "Your key goes here"
            deepclean: True
            #With deepclean you can clean the disk attached on the vm if you use private image
            delete_all_attached: all_autocreated
            #could be all or all_autocreated
            #( all: delete all resources attached to the vm, 
            #all_autocreated just delete everything but virtual network) 
# This part above is now required, but you can still specify it
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

  layout:
    inventory_layout:
      vars:
        hostname: __ip__
        log_url: __log__
        id: __id__
        credentials_filename: azure.key
        credentials_profile: key
      hosts:
        example-node:
          count: 1
          host_groups:
            - example
  hooks:
    postup:
      - name: azure_boot_log

#This is the minimum viable input for azure_vm
# Default setting use username and password, no public key
azure_vm_test:
  topology:
    topology_name: azure_vm_test
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - vm_name: "{{ distro }}-TestAzureAuto"
            resource_group: ccit
            role: azure_vm
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"

azure_multi_vm:
  topology:
    topology_name: azure_vm
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - vm_name: "{{ distro }}-TestMultiVm"
            count: 3
            role: azure_vm
            resource_group: ccit
            deepclean: True
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"
  layout:
    inventory_layout:
      vars:
        hostname: __ip__
      hosts:
        example-node:
          count: 4
          host_groups:
            - example

azure_availabilityset:
  topology:
    topology_name: azure_availabilityset
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - name: "{{ distro }}-Test_AV"
            role: azure_availabilityset
            resource_group: ccit
            sku: "Classic"
            platform_update_domain_count: 3
            platform_fault_domain_count: 3
        credentials:
          filename: azure.key
          profile: key

azure_vm_with_av:
  topology:
    topology_name: azure_vm_with_av
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - vm_name: "{{ distro }}-TEST-AV-vm"
            role: azure_vm
            count: 1
            resource_group: ccit
            availability_set: "Test_AV"
        credentials:
          filename: azure.key
          profile: key

azure_vm_ip:
  topology:
    topology_name: azure_vm_ip
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - name: "{{ distro }}-Test-Ip-Auto"
            role: azure_publicipaddress
            resource_group: ccit
            allocation_method: dynamic  
            sku: Basic
        credentials:
          filename: azure.key
          profile: key


azure_vm_loadbalancer:
  topology:
    topology_name: azure_vm_with_av
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - role: azure_loadbalancer
            sku: Basic
            name: "{{ distro }}-LB-Auto"
            resource_group: ccit
            frontend_ip_configurations:
              name: "{{ distro }}-AzureAutoLB"
              public_ip_address: "{{ distro }}-Test-Ip-Auto"
            backend_address_pools:
              name: "{{ distro }}-Backend-Pool-Auto"
            probes:
              name: "{{ distro }}-Probe-Auto"
              port: 80
            inbound_nat_pools:
              name: "{{ distro }}-inbound_nat_pools_Auto"
              frontend_ip_configuration_name: "{{ distro }}-AzureAutoLB"
              protocol: Tcp
              frontend_port_range_start: 80
              frontend_port_range_end: 81
              backend_port: 8080
            load_balancing_rules:
              name: "{{ distro }}-load_balancing_rules_Auto"
              frontend_ip_configuration: "{{ distro }}-AzureAutoLB"
              backend_address_pool: "{{ distro }}-Backend-Pool-Auto"
              frontend_port: 80
              backend_port: 80
              probe: "{{ distro }}-Probe-Auto"
# inbound_nat_pools and inbound_nat_rules can't appear at the same time
#            inbound_nat_rules:
#              name: "{{ distro }}-inbound_nat_rules_Auto"
#              backend_port: 8080
#              protocol: Tcp
#              frontend_port: 8080
#              frontend_ip_configuration: "{{ distro }}-AzureAutoLB"
        credentials:
          filename: azure.key
          profile: key

azure_nsg:
  topology:
    topology_name: azure_nsg
    resource_groups:
      - resource_group_name: "azure"
        resource_group_type: "azure"
        resource_definitions:
          - name: "{{ distro }}-Test-NSG-AUTO"
            role: azure_nsg
            resource_group: ccit
            purge_rules: True
            rules:
               name: DenySSH
               protocol: Tcp
               destination_port_range: 22
               access: Deny
               priority: 100
               direction: Inbound
        credentials:
          filename: azure.key
          profile: "{{ profile | default('key') }}"
