This is a new Virtual Machine Scale Set demo I have just released to official Ansible Playbooks for Azure.
I have updated Ansible modules to enable:
- creating images from existing Azure Virtual Machines
- updating custom image in Azure Virtual Machine Scale Set
This demo is divided into a few steps. First it demonstrates how to create two custom images (A and B), and we will create VMSS with image A, and finally we will dynamically change image A to image B.
Before trying the playbooks, clone following repository:
1 2 |
|
Step One - Create two virtual machines and install HTTPD
Run following playbook:
1
|
|
It will: - create 2 virtual machines - install HTTPD on both of them - change index.html to contain Image A and Image B respectively
Copy and paste IP addresses of both VMs to the browser:
You should see two different versions of VM:
and
Step Two - Capture Images from both Virtual Machines
Run second playbook to capture the images:
1
|
|
Step Three - Create VMSS using Image A
In this step we will create following components: - public IP address - load balancer - VMSS referring image A
Run following playbook:
1
|
|
Check the IP address printed out at the end:
check that it works in the browser:
Step Four - Update Image Reference in VMSS and Upgrade Instances
Run final playbook to replace image A with image B:
1
|
|
Now press F5 in the browser to reload page and see that image gas changed: