Score:0

Ansible roles cannot find azure modules

tr flag

The required azure files are in /home/ansible/.ansible/roles/azure.azure_modules/library/azure_rm_securitygroup.py but ansible roles cannot find it.

cat azure_playbook.yaml
---
-
  hosts: localhost
  connection: local
  gather_facts: false

  roles:
    - azure_vms

I get the following error:

TASK [azure_vms : Create Network Security Group that allows SSH] *************************************************************************************************************************************************************************************************************
task path: /home/ansible/azure_ansible/azure_vms/tasks/main.yml:3
redirecting (type: modules) ansible.builtin.azure_rm_securitygroup to azure.azcollection.azure_rm_securitygroup
fatal: [localhost]: FAILED! => {
    "msg": "The module azure_rm_securitygroup was redirected to azure.azcollection.azure_rm_securitygroup, which could not be loaded."
}
Score:0
th flag

Since you are using a version of Ansible with support for collections, you should use the currently supported azure.azcollection collection instead of the azure.azure_modules role, which has not been updated since 2019.

If you must use the role, you have to manually load it before attempting to use any modules from it (this is one of the downsides of using a role that was fixed in the design of collections.)

-
  hosts: localhost
  connection: local
  gather_facts: false

  roles:
    - azure.azure_modules
    - azure_vms
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.