Ability to create Azure automation account via Ansible

25 views
Skip to first unread message

ameya agashe

unread,
Oct 4, 2018, 10:52:13 PM10/4/18
to ansible...@googlegroups.com
Hi Guys,

Are we not able to create an Azure automation account with Ansible? Seems a simple request but I am not able to figure it out.

Would appreciate your guidance.

Thank you very much.

Kind regards
Ameya Agashe

P. S: Kindly ignore if this sounds too simple question, I am new to Ansible world.

ameya agashe

unread,
Oct 5, 2018, 12:37:34 AM10/5/18
to ansible...@googlegroups.com
Apparently, there is no module for creation of azure automation account?

ameya agashe

unread,
Oct 8, 2018, 7:34:29 PM10/8/18
to ansible...@googlegroups.com
Hi is this message gone in spam somewhere??

Ameya

Brad Van Orden

unread,
Oct 9, 2018, 5:36:51 AM10/9/18
to Ansible Project
No, I have no idea what azure is.  So, can't offer any help.  You have not provided any details.  Possibly describe what the process is for creating an azure account without ansible and what problems you are having with using ansible.  Give us the steps you have attempted so far. 

ameya agashe

unread,
Oct 9, 2018, 6:20:13 AM10/9/18
to ansible...@googlegroups.com
Hi Brad,

Appreciate your prompt response.Azure is a public cloud offering from Microsoft. WIthout Ansible, I would create the account with "Azure PowerShell" with the below command.:

New-AzureRmAutomationAccount `
-ResourceGroupName "${resource_grp_name_fred_nxt_old_prod}" `
-Name "${azure_automation_account_name}" `
-Location "${automation_account_location}"

What I have done so far is, I am being able to provision a base Windows 2016 Server in Azure, I want to now, automate the manual configuration task, first thing is to provision an automation account. The below snippet is of my yaml file which I run in Azure cloud shell and it provisions the environment.


- name: Create Azure VM
hosts: localhost
connection: local
tasks:
- name: Create resource group
azure_rm_resourcegroup:
name: myResourceGroup
location: eastus
- name: Create virtual network
azure_rm_virtualnetwork:
resource_group: myResourceGroup
name: myVnet
address_prefixes: "10.0.0.0/16"
- name: Add subnet
azure_rm_subnet:
resource_group: myResourceGroup
name: mySubnet
address_prefix: "10.0.1.0/24"
virtual_network: myVnet
- name: Create public IP address
azure_rm_publicipaddress:
resource_group: myResourceGroup
allocation_method: Static
name: myPublicIP
register: output_ip_address
- name: Dump public IP for VM which will be created
debug:
msg: "The public IP is {{ output_ip_address.state.ip_address }}."
- name: Create Network Security Group that allows RDP
azure_rm_securitygroup:
resource_group: myResourceGroup
name: myNetworkSecurityGroup
rules:
- name: RDP
protocol: Tcp
destination_port_range: 3389
access: Allow
priority: 1002
direction: Inbound
- name: Create virtual network inteface card
azure_rm_networkinterface:
resource_group: myResourceGroup
name: myNIC
virtual_network: myVnet
subnet: mySubnet
public_ip_name: myPublicIP
security_group: myNetworkSecurityGroup
- name: Create VM
azure_rm_virtualmachine:
resource_group: myResourceGroup
name: myVM
vm_size: Standard_DS1_v2
admin_username: svc_admin
admin_password: Hash#Dollar$135
os_type: Windows
network_interfaces: myNIC
image:
offer: WindowsServer
publisher: MicrosoftWindowsServer
sku: '2016-Datacenter'
version: latest


The main game, as I see is using Azure ansible modules, I couldn't locate the equivalent to create an automation account.

Kindly assist

Thanks
Ameya Agashe


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/ea661cef-a889-45d0-a88b-0b1d067b4f14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brad Van Orden

unread,
Oct 9, 2018, 7:39:42 AM10/9/18
to Ansible Project
OK.  Haven't touched Windows Server for a couple of years.  :)
I searched the azure modules in ansible and like you, did not see anything directly related.  My suggestion: since you already have a poweshell command to create the account, use the win_command module to run the powershell command where needed.  That will probably be your fastest method to get your task accomplished.
Reply all
Reply to author
Forward
0 new messages