Zim's Notes

Just work related notes.

Note on Ansible Examples

When I started working with Ansible I wa

Let’s do following exercise. I want to create an Azure Virtual Machine using examples from documentation.

Let’s start with default virtual machine example (https://docs.ansible.com/ansible/latest/modules/azure_rm_virtualmachine_module.html)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- name: Create Azure VM using default samples
  hosts: localhost
  connection: local
  tasks:
    - name: Create VM with defaults
      azure_rm_virtualmachine:
        resource_group: Testing
        name: testvm10
        admin_username: chouseknecht
        admin_password: <your password here>
        image:
          offer: CentOS
          publisher: OpenLogic
          sku: '7.1'
          version: latest

Now, Ansible will complain that resource group Testing is not present, so I add resource group from here https://docs.ansible.com/ansible/latest/modules/azure_rm_resourcegroup_module.html:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
- name: Create Azure VM using default samples
  hosts: localhost
  connection: local
  tasks:
    - name: Create a resource group
      azure_rm_resourcegroup:
        name: Testing
        location: westus
        tags:
          testing: testing
          delete: never
    - name: Create VM with defaults
      azure_rm_virtualmachine:
        resource_group: Testing
        name: testvm10
        admin_username: chouseknecht
        admin_password: <your password here>
        image:
          offer: CentOS
          publisher: OpenLogic
          sku: '7.1'
          version: latest