4

I'm trying to use the Azure modules for Ansible on Red Hat. I followed the official documentation for Ansible installation on site. While executing the Ansible playbook I ran into below problem.

Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on azure-redhat Python /usr/bin/python2.

I removed Ansible and pip packages and reinstalled them. The problem still persists. Can anyone help me with it?

  • Ansible version = 2.8.4
  • python2.7
  • Redhat 7.
kenlukas
  • 3,616
  • 9
  • 25
  • 36
Manpreet
  • 119
  • 2
  • 8
  • Can you give a pointer to the documentation you followed. I want to see how (sources+which command+which user) you installed ansible, pip and azure modules. – xenlo Aug 28 '19 at 11:51
  • 1
    https://learn.microsoft.com/en-us/azure/virtual-machines/linux/ansible-install-configure ? – xenlo Aug 28 '19 at 11:52
  • 1
    https://docs.ansible.com/ansible/latest/scenario_guides/guide_azure.html I followed the above link and executed pip install 'ansible[azure]' – Manpreet Aug 28 '19 at 12:09

1 Answers1

1

As the comment points it out, you could follow this document to install Ansible on an Azure Linux virtual machine.

  • Install the required packages for the Azure Python SDK modules.

    sudo yum check-update; sudo yum install -y gcc libffi-devel python-devel openssl-devel epel-release sudo yum install -y python-pip python-wheel

  • Install the required packages for the Azure Python SDK modules.

    sudo pip install ansible[azure]

This works for me on RedHat 7.4 azure VM. enter image description here

Nancy
  • 26,865
  • 3
  • 18
  • 34