Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation for Azure RM with AKS all of sudden stopped working, any idea why? #384

Open
Aech1977 opened this issue Jun 18, 2020 · 3 comments

Comments

@Aech1977
Copy link

So i've had this CI/CD pipeline running for months with the occasional hiccups (to be fair it ran like clockwork for the last few months and then all of sudden I started getting the occasional failure but I would rerun it and it would be ok. That happened for about a 2 weeks. Now its just stopped working. Below is the code:

  • name: Create resource group
    azure_rm_resourcegroup:
    name: "{{ rg }}"
    location: "{{ location }}"
    state: present

  • name: List supported kubernetes version from Azure
    azure_rm_aksversion_info:
    location: "{{ location }}"
    register: versions

  • name: Create AKS cluster with RBAC enabled
    azure_rm_aks:
    name: "{{ aks_name|lower }}"
    location: "{{ aks_locale }}"
    resource_group: "{{ rg }}"
    dns_prefix: '{{ aks_name|lower|replace ("_", "-")}}-dns'
    addon:
    http_application_routing:
    enabled: yes
    enable_rbac: yes
    kubernetes_version: "{{ version }}"
    agent_pool_profiles:
    - name: default
    count: 3
    vm_size: Standard_D2_v2
    linux_profile:
    admin_username: ansible
    ssh_key: "{{ vault_ssh_key }}"
    service_principal:
    client_id: "{{ vault_client_id }}"
    client_secret: "{{ vault_client_secret }}"

aad_profile:

client_app_id: "{{ client_app_id }}"

server_app_secret: "{{ client_app_secret }}"

tenant_id: "{{ lookup('env', 'TENANT_ID') }}"

state: present

register: aks
changed_when: false

  • name: Save cluster user config
    copy:
    content: "{{ aks.kube_config }}"
    dest: "aks-{{ aks_name|lower }}-kubeconfig-user"
    register: usr_config
    changed_when: false

  • name: Get admin config of AKS
    azure_rm_aks_info:
    resource_group: "{{ rg }}"
    name: "{{ aks_name|lower }}"
    show_kubeconfig: admin
    register: aks_admin
    changed_when: false

#- name: Save the kubeconfig

copy:

content: "{{ aks.aks[0].kube_config }}"

dest: "aks-{{ aks_name }}-kubeconfig"

register: save_kubecfg

changed_when: false

Keep in mind i just added the code for http_application_routing but I removed it (commented out and its throwing the exact same error). The error is here:

{
"module_stdout": "",
"module_stderr": "Traceback (most recent call last):\n File "", line 102, in \n File "", line 94, in _ansiballz_main\n File "", line 40, in invoke_module\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_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 838, in \n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 834, in main\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 526, in init\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/module_utils/azure_rm_common.py", line 348, in init\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 542, in exec_module\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 752, in get_aks\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 304, in create_aks_dict\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 330, in create_addon_dict\nTypeError: 'NoneType' object does not support item assignment\n",
"exception": "Traceback (most recent call last):\n File "", line 102, in \n File "", line 94, in _ansiballz_main\n File "", line 40, in invoke_module\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_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 838, in \n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 834, in main\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 526, in init\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/module_utils/azure_rm_common.py", line 348, in init\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 542, in exec_module\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 752, in get_aks\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 304, in create_aks_dict\n File "/tmp/ansible_azure_rm_aks_payload_gcdotlf1/ansible_azure_rm_aks_payload.zip/ansible/modules/cloud/azure/azure_rm_aks.py", line 330, in create_addon_dict\nTypeError: 'NoneType' object does not support item assignment\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1,
"_ansible_no_log": false,
"changed": false
}

I have no idea why this is happening out of no where. If I have to I will start off commenting everything but the basics out but I'm still learning ansible so I cant help but feel like there is something I'm missing. The fact it broke on its own is the only I feel like something else may be wrong.

protip: I'm running this thru AWX 4.0.0 on Ansible 2.9.

@toharikr
Copy link

Did you find any solution?

@Aech1977
Copy link
Author

Aech1977 commented Jun 24, 2020

Yeah it appears something broke and they made a merge request with the fix. There is a way to call the replacement code down but I havent figured out how to implement it.

ansible-collections/azure#167

@SpikePy
Copy link

SpikePy commented Aug 4, 2020

Hi I'm the guy from the bug report. It's already fixed in the current version of ansible 2.9.11 that i get when i install it via pip install ansible[azure]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants