Error: the python NetApp-Lib module is required

I’m trying to run a playbook against a NetApp cluster. I have all of the collections installed with a requirements.yml file.

I have created a requirements.txt file in order to install the ‘netapp-lib’ python library. Then, within the template for the job, I added a variable:

---
ansible_python_interpreter: "/usr/bin/env python"

This is the error returned when trying to run the playbook and for the job to install the Python library ‘netapp-lib’.

**value(s) in REST: ['root_volume', 'root_volume_aggregate',**

15

**'root_volume_security_style']**

16

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error: the python NetApp-Lib module is required. Import error: No module named 'netapp_lib'"}

Looking at ansible docs the ‘root_volume_security_style’ is correct, so I can only assume I’m receiving that error because the Python module is noe installing. I’m doing this all from within AWX.

Here is the playbook information:

---
- hosts: localhost
  gather_facts: false
  name: NetApp SVM Setup
  vars_files:
  - variables-1.yml

  tasks:
  - name: Define login
    set_fact:
      login:
        hostname: "{{ clusterip }}"
        username: "{{ user }}"
        password: "{{ pass }}"
        validate_certs: "{{ validate_certs_option }}"

  - name: Create SVM
    na_ontap_svm:
      state: present
      name: "{{ svmname }}"
      root_volume: "{{ rootvolname }}"
      root_volume_aggregate: "{{ rootvolaggr }}"
      root_volume_security_style: "{{ rootvolsecurity }}"
      aggr_list: "{{ allowedaggrs }}"
      allowed_protocols: "{{ allowedprotocols }}"
      hostname: "{{ clusterip }}"
      username: "{{ user }}"
      password: "{{ pass }}"
      validate_certs: "{{ validate_certs_option }}"

  - name: Start NFS
    na_ontap_nfs:
      state: present
      service_state: started
      vserver: "{{ svmname }}"
      nfsv3: enabled
      hostname: "{{ clusterip }}"
      username: "{{ user }}"
      password: "{{ pass }}"
      validate_certs: "{{ validate_certs_option }}"
      

  - name: Create NFS Export Rule Under Default Policy
    na_ontap_export_policy_rule:
      state: present
      name: default
      vserver: "{{ svmname }}"
      client_match: "{{ nfsclientmatchsubnet }}"
      ro_rule: sys
      rw_rule: sys
      protocol: nfs
      super_user_security: any
      hostname: "{{ clusterip }}"
      username: "{{ user }}"
      password: "{{ pass }}"
      validate_certs: "{{ validate_certs _option }}"
  - debug: msg="{{ svmname }} has been created along with 1 NFS volume called {{ nfsvolname1 }}"

Hey @marshit the netapp collection is not included in the default EE for awx so you will need to build your own with ansible-builder and then use that EE for this job template/project. You can find docs on how to get the EE into AWX here.

1 Like

IIRC you can load collections from Galaxy into the default Execution Environment at runtime - the file that defines your collection dependencies must be formatted in YAML, named requirements.yml and saved in the collections/ directory of your repo. Making a custom EE is definitely more efficient, though.

Oh, reading your post more closely, you’re not seeing missing Ansible modules, but a missing Python module. Sorry I misunderstood.

You should be able to install a python package from your playbook with a task or pre-task:

- name: Install NetApp-Lib python package
  ansible.builtin.pip:
    name: NetApp-Lib

Docs: ansible.builtin.pip module – Manages Python library dependencies — Ansible Documentation

I think what I’m finding is that an execution environment is the way to go for this NetApp stuff, sadly. If that doesn’t work, then @acozine I will try your step.

I’m going to try the execution environment first and update this post.

@acozine I tried your steps, but I was told I had missing Python dependencies when trying to run my playbook. Then I proceeded to try creating an execution environment. I’m using Podman for the EE.

I have my file on my local AWX host:

bindep.txt
requirements.txt
requirements.yml
execution-environment.yml

I got them from here - GitHub - schmots1/na-ansible-ee: Files for building a NetApp computable Ansible Execution Enviornment

Ran the commands:

pip3 install ansible-builder build

ansible-builder build --container-runtime=podman --tag myregistry.io/ansible-ee-netapp -f execution-environment.yml -v 3

I receive the following error below:

→ 944c522e0fa
[2/4] STEP 12/12: RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.ym l --collections-path “/usr/share/ansible/collections”
Starting galaxy collection install process
Process install dependency map
[WARNING]: Skipping Galaxy server Api Root – Pulp 3. Got an
unexpected error when getting available versions of collection
community.general: ‘/api/v3/plugin/ansible/content/published/collections/index/
community/general/versions/’
ERROR! Unexpected Exception, this is probably a bug: ‘/api/v3/plugin/ansible/content/published/collections/index/community/general/versions/’
to see the full traceback, use -vvv
Error: building at STEP “RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirem ents.yml --collections-path “/usr/share/ansible/collections””: while running runtime: exit status 250

I’m basically being told that none of the collections within my requirements.yml file has a requiremetns.txt file.

As you can see, they all do, although they are blank, but that should be fine.

/home/admin/.ansible/collections/ansible_collections/amazon/aws/requirements.txt
/home/admin/.ansible/collections/ansible_collections/amazon/aws/test-requirements.txt
/home/admin/.ansible/collections/ansible_collections/amazon/aws/tests/integration/requirements.txt
/home/admin/.ansible/collections/ansible_collections/amazon/aws/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/ansible/posix/requirements.txt
/home/admin/.ansible/collections/ansible_collections/ansible/posix/test-requirements.txt
/home/admin/.ansible/collections/ansible_collections/ansible/posix/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/cloud/common/requirements.txt
/home/admin/.ansible/collections/ansible_collections/cloud/common/test-requirements.txt
/home/admin/.ansible/collections/ansible_collections/cloud/common/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/community/general/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/community/vmware/requirements.txt
/home/admin/.ansible/collections/ansible_collections/community/vmware/test-requirements.txt
/home/admin/.ansible/collections/ansible_collections/community/vmware/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/aws/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/aws/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/azure/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/azure/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/elementsw/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/elementsw/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/ontap/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/ontap/execution_environments/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/ontap/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/storagegrid/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/storagegrid/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/um_info/requirements.txt
/home/admin/.ansible/collections/ansible_collections/netapp/um_info/tests/unit/requirements.txt
/home/admin/.ansible/collections/ansible_collections/vmware/vmware_rest/docs-requirements.txt
/home/admin/.ansible/collections/ansible_collections/vmware/vmware_rest/requirements.txt
/home/admin/.ansible/collections/ansible_collections/vmware/vmware_rest/test-requirements.txt
collections:
- name: netapp.aws
- name: netapp.azure
- name: netapp.cloudmanager
- name: netapp.elementsw
- name: netapp.ontap
- name: netapp.storagegrid
- name: netapp.um_info
- name: netapp_eseries.santricity

So, I’m at a loss as to why this is happening.

that galaxy error is interesting. are you able to pull down collections with just ansible-galaxy collection install some.collection?

I will see if I can find time to build an EE and give things a test.

1 Like

@thedoubl3j yes, individually they seem to work fine, but yet, even then, when in AWX I still can’t get anything NetApp related to work for projects.

As if the collections still didn’t install.

Makes me think how is this better than just using Python LOL

But thanks for the help if you get a chance. Sometime I feel like it was my internet, but I can curl just fine to some of the individual collection websites.

By far these are the best set (and only) instructions I found that worked to install an EE environment.

I’m good now, this ticket is done.

1 Like

So by following the article above, I was able to get my execution environment setup and running. The problem now is that when I try to gather inventory, which works when I use the default AWX EE, I get no joy.

Receptor detail:
Error creating pod: container failed to start, ImagePullBackOff

When I run “podman images” I get the following:

REPOSITORY                                                   TAG         IMAGE ID           CREATED                SIZE
localhost/custom-ee                                        latest      bfe6c40bad52    21 seconds ago      626 MB

`quay.io/ansible/ansible-runner`

What could be causing the problem or how to troubleshoot the image pull failure?

I was able to finally get my quay.io account is finally working properly. So this post, I would say, is resolved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.