I'm running a sample Ansible playbook to deploy AKS cluster in Azure using the MS reference AKS Configure Clusters.
- name: Create Azure Kubernetes Service
hosts: localhost
connection: local
vars:
resource_group: myResourceGroup
location: eastus
aks_name: myAKSCluster
username: azureuser
ssh_key: "your_ssh_key"
client_id: "your_client_id"
client_secret: "your_client_secret"
aks_version: 1.25.1
tasks:
- name: Create resource group
azure_rm_resourcegroup:
name: "{{ resource_group }}"
location: "{{ location }}"
- name: Create a managed Azure Container Services (AKS) cluster
azure_rm_aks:
name: "{{ aks_name }}"
location: "{{ location }}"
resource_group: "{{ resource_group }}"
dns_prefix: "{{ aks_name }}"
kubernetes_version: "{{aks_version}}"
linux_profile:
admin_username: "{{ username }}"
ssh_key: "{{ ssh_key }}"
service_principal:
client_id: "{{ client_id }}"
client_secret: "{{ client_secret }}"
agent_pool_profiles:
- name: default
count: 2
vm_size: Standard_D2_v2
tags:
Environment: Production
While running the playbook I'm getting the following error. In short it is related to AKS API version not available and the aks_version
I'm using is 1.25.1
.
ERROR:
NotImplementedError(\"APIVersion {} is not available\".format(api_version))\nNotImplementedError: APIVersion 2019-04-01 is not available\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
FULL ERROR:
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "/home/testadmin/.local/lib/python3.6/site-packages/jwt/utils.py:7: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.\n from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve\nTraceback (most recent call last):\n File \"/home/testadmin/.ansible/tmp/ansible-tmp-1690451830.9166908-10596-266740633455905/AnsiballZ_azure_rm_aks.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/testadmin/.ansible/tmp/ansible-tmp-1690451830.9166908-10596-266740633455905/AnsiballZ_azure_rm_aks.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/testadmin/.ansible/tmp/ansible-tmp-1690451830.9166908-10596-266740633455905/AnsiballZ_azure_rm_aks.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.azure.azcollection.plugins.modules.azure_rm_aks', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_azure_rm_aks_payload_is6qsl0c/ansible_azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_aks.py\", line 920, in <module>\n File \"/tmp/ansible_azure_rm_aks_payload_is6qsl0c/ansible_azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_aks.py\", line 916, in main\n File \"/tmp/ansible_azure_rm_aks_payload_is6qsl0c/ansible_azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_aks.py\", line 586, in __init__\n File \"/tmp/ansible_azure_rm_aks_payload_is6qsl0c/ansible_azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py\", line 432, in __init__\n File \"/tmp/ansible_azure_rm_aks_payload_is6qsl0c/ansible_azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_aks.py\", line 602, in exec_module\n File \"/tmp/ansible_azure_rm_aks_payload_is6qsl0c/ansible_azure_rm_aks_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_aks.py\", line 830, in get_aks\n File \"/home/testadmin/.local/lib/python3.6/site-packages/azure/mgmt/containerservice/container_service_client.py\", line 152, in managed_clusters\n raise NotImplementedError(\"APIVersion {} is not available\".format(api_version))\nNotImplementedError: APIVersion 2019-04-01 is not available\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}