Skip to content

Instantly share code, notes, and snippets.

@IPvSean
Last active January 12, 2021 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IPvSean/70255ff9dd3d663b98fcf4dfff654991 to your computer and use it in GitHub Desktop.
Save IPvSean/70255ff9dd3d663b98fcf4dfff654991 to your computer and use it in GitHub Desktop.
---
- name: Create VM
azure.azcollection.azure_rm_virtualmachine:
resource_group: myResourceGroup
name: RHEL8-ansible
vm_size: Standard_DS1_v2
admin_username: azureuser
ssh_password_enabled: false
ssh_public_keys:
- path: /home/azureuser/.ssh/authorized_keys
key_data: "{{public_key}}"
network_interfaces: myNIC
image:
offer: RHEL
publisher: RedHat
sku: '8.1'
version: latest
(azure) ➜ azure git:(master) ✗ ansible-playbook spin_up_rhel.yml
PLAY [Create Azure VM] **************************************************************************************************************************************************************
TASK [Create resource group] ********************************************************************************************************************************************************
ok: [localhost]
TASK [Create virtual network] *******************************************************************************************************************************************************
ok: [localhost]
TASK [Add subnet] *******************************************************************************************************************************************************************
ok: [localhost]
TASK [Create public IP address] *****************************************************************************************************************************************************
ok: [localhost]
TASK [Dump public IP for VM which will be created] **********************************************************************************************************************************
ok: [localhost] => {
"msg": "The public IP is 52.188.208.206"
}
TASK [Create Network Security Group that allows SSH] ********************************************************************************************************************************
ok: [localhost]
TASK [Create virtual network inteface card] *****************************************************************************************************************************************
ok: [localhost]
TASK [Create VM] ********************************************************************************************************************************************************************
changed: [localhost]
PLAY RECAP ************************************************************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment