{
      "name": "[concat(parameters('sqlserverName'),'/',parameters('databasesList')[copyIndex()])]",
      "type": "Microsoft.Sql/servers/databases",
      "location": "[resourceGroup().location]",
      "tags": {
        "displayName": "[parameters('databasesList')[copyIndex()]]"
      },
      "copy": {
        "name": "databasesCopy",
        "count": "[length(parameters('databasesList'))]"
      },
      "apiVersion": "2014-04-01-preview",
      "dependsOn": [
        "[concat('Microsoft.Sql/servers/', parameters('sqlserverName'))]"
      ],
      "properties": {
        "edition": "[parameters('edition')]",
        "collation": "[parameters('collation')]",
        "maxSizeBytes": "[parameters('maxSizeBytes')]",
        "requestedServiceObjectiveName": "[parameters('requestedServiceObjectiveName')]"
      }
    }

     Node localhost
    {
        WindowsFeature DNS 
        { 
            Ensure = "Present" 
            Name = "DNS"
        }
        xDnsServerAddress DnsServerAddress 
        { 
            Address        = '127.0.0.1' 
            InterfaceAlias = $InterfaceAlias
            AddressFamily  = 'IPv4'
        }
        xWaitforDisk Disk2
        {
             DiskNumber = 2
             RetryIntervalSec =$RetryIntervalSec
             RetryCount = $RetryCount
        }
        cDiskNoRestart ADDataDisk
        {
            DiskNumber = 2
            DriveLetter = "F"
        }
        WindowsFeature ADDSInstall 
        { 
            Ensure = "Present" 
            Name = "AD-Domain-Services"
        }   

…
- name: Configure instances
  hosts: (machines dans /etc/ansible/hosts)
  tasks:
  # On installe nginx
  - name: Installs nginx web server
    apt: pkg=nginx state=installed update_cache=true
    notify:
      - start nginx
    become: true

---
- name: Provision instances
  hosts: localhost
  connection: local
  gather_facts: True
  tasks:

  # D'abord on crée un Ressources Group'
  - name: Create Ansible Resourcegroup instances
    azure_rm_resourcegroup:
      name: Ansible_RG
      force: true
      state: present
      location: westus

  # Ensuite on crée un compte de stockage
  - name: Create Ansible Storage Account instances
    azure_rm_storageaccount:
      resource_group: Ansible_RG
      name: ansiblesto02
      account_type: Standard_LRS

  # En suite on crée le Vnet
  - name: Create Ansible Virtual Network instances ...
    azure_rm_virtualnetwork:
      resource_group: Ansible_RG
      name: ansible_vnet_01
      address_prefixes: "10.10.0.0/16"

  # En suite on crée les subnets
  - name: Create Ansible Subnet instances ...
    azure_rm_subnet:
      resource_group: Ansible_RG
      name: ansible_subnet_01
      address_prefix: "10.10.0.0/24"
      virtual_network: ansible_vnet_01

  # En suite on provisionne un ip Public
  - name: Create Public IP 01
    azure_rm_publicipaddress:
      resource_group: Ansible_RG
      allocation_method: Static
      domain_name_label: ansiblevm01
      name: ansible_pip_01

  # Creation d'un NSG pour le SSH
  - name: Create NSG with SSH Enabled
    azure_rm_securitygroup:
      resource_group: Ansible_RG
      name: ansible_nsc_01
      rules:
        - name: SSH
          protocol: Tcp
          destination_port_range: 22
          access: Allow
          priority: 101
          direction: Inbound

  # Utilisation des objets dejà créés pour creer une NIC
  - name: Create NIC with other Parameters (PIP,VNET,SUBNET...)...
    azure_rm_networkinterface:
      resource_group: Ansible_RG
      name: ansible_nic_01
      virtual_network: ansible_vnet_01
      subnet: ansible_subnet_01
      public_ip_name: ansible_pip_01
      security_group: ansible_nsc_01

  # Et on crée la VM
  - name: Launch instances
    azure_rm_virtualmachine:
      resource_group: Ansible_RG
      name: ansiblevm01
      vm_size: Standard_A0
      os_type: Linux
      storage_account: ansiblesto02
      storage_container: ansiblevm01
      storage_blob: os-vm-01.vhd
      admin_username: testadmin
      admin_password: Password1234!
      network_interfaces: ansible_nic_01
      image:
        offer: UbuntuServer
        publisher: Canonical
        sku: '16.04-LTS'
        version: latest

provider "azurerm" {
  subscription_id = "<subscription_id>"
  client_id       = "<client_id>"
  client_secret   = "<secret>"
  tenant_id       = "<tenant_id>"
}
variable "RessourceGroupName" {
  default = "RG-Terraform-Ansible"
}
variable "StoragAccountName" {
  default = "terraansible"
}
resource "azurerm_resource_group" "terraform-ansible" {
  name     = "${var.RessourceGroupName}"
  location = "West US"
}
resource "azurerm_virtual_network" "terraform-vnet" {
  name                = "${azurerm_resource_group.terraform-ansible.name}-vnet"
  address_space       = ["10.0.0.0/16"]
  location            = "West US"
  resource_group_name = "${azurerm_resource_group.terraform-ansible.name}"
}
resource "azurerm_subnet" "terraform-subnet" {
  name                      = "${azurerm_resource_group.terraform-ansible.name}-subnet"
  resource_group_name       = "${azurerm_resource_group.terraform-ansible.name}"
  virtual_network_name      = "${azurerm_virtual_network.terraform-vnet.name}"
  address_prefix            = "10.0.2.0/24"
  network_security_group_id = "${azurerm_network_security_group.terraform-nsg.id}"
}
resource "azurerm_public_ip" "terraform-pip" {
  name                         = "${azurerm_resource_group.terraform-ansible.name}PublicIp1"
  resource_group_name          = "${azurerm_resource_group.terraform-ansible.name}"
  public_ip_address_allocation = "static"
  location                     = "West US"
}
resource "azurerm_network_security_group" "terraform-nsg" {
  name                = "${azurerm_resource_group.terraform-ansible.name}SecurityGroup1"
  location            = "West US"
  resource_group_name = "${azurerm_resource_group.terraform-ansible.name}"
  security_rule {
    name                       = "test123"
    priority                   = 100
    direction                  = "Inbound"
    access                     = "Allow"
    protocol                   = "Tcp"
    source_port_range          = "*"
    destination_port_range     = "*"
    source_address_prefix      = "*"
    destination_address_prefix = "*"
  }
  tags {
    environment = "Production"
  }
}
resource "azurerm_network_interface" "terraform-network_interface" {
  name                = "${azurerm_resource_group.terraform-ansible.name}-nic"
  location            = "West US"
  resource_group_name = "${azurerm_resource_group.terraform-ansible.name}"
  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = "${azurerm_subnet.terraform-subnet.id}"
    private_ip_address_allocation = "dynamic"
    public_ip_address_id          = "${azurerm_public_ip.terraform-pip.id}"
  }
}
resource "azurerm_storage_account" "terraform-storage" {
  name                = "${var.StoragAccountName}"
  resource_group_name = "${azurerm_resource_group.terraform-ansible.name}"
  location            = "westus"
  account_type        = "Standard_LRS"
  tags {
    environment = "staging"
  }
}
resource "azurerm_availability_set" "terraform-availability-set" {
  name                = "${azurerm_resource_group.terraform-ansible.name}AvailabilitySet1"
  location            = "West US"
  resource_group_name = "${azurerm_resource_group.terraform-ansible.name}"
  tags {
    environment = "Production"
  }
}
resource "azurerm_storage_container" "terraform-container" {
  name                  = "vhds"
  resource_group_name   = "${azurerm_resource_group.terraform-ansible.name}"
  storage_account_name  = "${azurerm_storage_account.terraform-storage.name}"
  container_access_type = "private"
}
resource "azurerm_virtual_machine" "terraform-vm" {
  name                  = "${azurerm_resource_group.terraform-ansible.name}-vm"
  location              = "West US"
  resource_group_name   = "${azurerm_resource_group.terraform-ansible.name}"
  network_interface_ids = ["${azurerm_network_interface.terraform-network_interface.id}"]
  vm_size               = "Standard_A0"
  availability_set_id   = "${azurerm_availability_set.terraform-availability-set.id}"
  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"
  }
  storage_os_disk {
    name          = "myosdisk1"
    vhd_uri       = "${azurerm_storage_account.terraform-storage.primary_blob_endpoint}${azurerm_storage_container.terraform-container.name}/myosdisk1.vhd"
    caching       = "ReadWrite"
    create_option = "FromImage"
  }
  storage_data_disk {
    name          = "datadisk0"
    vhd_uri       = "${azurerm_storage_account.terraform-storage.primary_blob_endpoint}${azurerm_storage_container.terraform-container.name}/datadisk0.vhd"
    disk_size_gb  = "1023"
    create_option = "Empty"
    lun           = 0
  }
  os_profile {
    computer_name  = "hostname"
    admin_username = "testadmin"
    admin_password = "Password1234!"
  }
  os_profile_linux_config {
    disable_password_authentication = false
  }
  tags {
    environment = "Production"
  }
}
resource "azurerm_virtual_machine_extension" "Ansible-Install" {
  name                 = "Ansible-Azure-Install"
  location             = "West US"
  resource_group_name  = "${azurerm_resource_group.terraform-ansible.name}"
  virtual_machine_name = "${azurerm_virtual_machine.terraform-vm.name}"
  publisher            = "Microsoft.OSTCExtensions"
  type                 = "CustomScriptForLinux"
  type_handler_version = "1.2"
  settings = <<SETTINGS
{
    "fileUris": ["https://raw.githubusercontent.com/EtienneDeneuve/Azure/master/Terraform/02%20-%20Ansible/ansible.sh"],
    "commandToExecute": "sh ansible.sh -s <subscription_id> -c <client_id> -k <secret> -t <tenant_id>",
    "timestamp": "19"
}
SETTINGS
}

Docker pull nginx 
Docker run -d –p 80:80 nginx

FROM dockerfile/ubuntu

# Install Nginx.
RUN \
  add-apt-repository -y ppa:nginx/stable && \
  apt-get update && \
  apt-get install -y nginx && \
  rm -rf /var/lib/apt/lists/* && \
  echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
  chown -R www-data:www-data /var/lib/nginx

# Define mountable directories.
VOLUME ["/etc/nginx/sites-enabled", "/etc/nginx/certs", "/etc/nginx/conf.d", "/var/log/nginx", "/var/www/html"]

# Define working directory.
WORKDIR /etc/nginx

# Define default command.
CMD ["nginx"]

# Expose ports.
EXPOSE 80
EXPOSE 443