Hi there,
I am working with ansible 2.9 and ansible[azure] modules. These have been successfully installed and configured, as I can create resources within AzureStack.
ansible 2.9.0
config file = /ansible/azure_stack/ansible.cfg
configured module search path = [‘/root/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Apr 2 2020, 13:34:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
However, my playbook fails when it comes to creating a virtual machine. The playbook is able to create vnet, subnet, nsg, public ip, nic all without issue and without specifying api_profile parameter. I am only encountering this with the virtualmachine resource.
I’ve reviewed the documentation and searched around for examples but I can’t find anything pertaining to AzureStack and Ansible.
Task:
- name: Create VM
azure_rm_virtualmachine:
resource_group: ansible
name: “vm-linuxweb-{{ count }}”
vm_size: Standard_DS1_v2
admin_username: ansible
admin_password: “{{ ansible_password }}”
ssh_password_enabled: true
network_interfaces: nic-linux
image:
offer: centos
publisher: openlogic
sku: ‘7.5’
version: latest
api_profile: “2017-03-09-profile”
I’ve been trying various versions for the api_profile parameter and nothing is working, but it draws out different errors.
Errors:
-
api_profile: “latest”
The error was: Message: The resource type ‘locations/vmSizes’ could not be found in the namespace ‘Microsoft.Compute’ for api version ‘2018-06-01’. The supported api-versions are ‘2015-06-15,2016-03-30,2017-03-30,2017-12-01’ -
api_profile: “2017-03-09”
Error retrieving resource group ansible - ‘unknown Azure API profile: 2017-03-09’" -
api_profile: “2017-03-09-profile”
The error was: Message: The resource type ‘locations/vmSizes’ could not be found in the namespace ‘Microsoft.Compute’ for api version ‘2018-06-01’. The supported api-versions are ‘2015-06-15,2016-03-30,2017-03-30,2017-12-01’
I know getting anything to work on AzureStack can be a challenge, but I really hoping I can get this going as Ansible has really helped in other areas.
Thank you,
Charles