Getting error in using register module

Hello,
I am getting below error while using register module with network modules(ios_command & nxos_command).
Can someone help on the issue.

ERROR! Module “register” shadows the name of a reserved keyword. Please rename or remove this module. Found at /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/register.py

If you could show your code that would be much better to understand.

The script being used.

For Cisco Devices

  • hosts: Cisco_SW
    gather_facts: true
    connection: local

tasks:

  • name: show run
    ios_command:
    commands:

  • show run
    host: “{{ ansible_host }}”
    username: “{{ un }}”
    password: “{{ pwd }}”
    register: config

  • name: save output to /etc/ansible/backups
    copy:
    content: “{{ config.stdout[0] }}”
    dest: “/etc/ansible/backups/show_run_{{ inventory_hostname }}_{{ansible_date_time.date}}.txt”

The problem for whatever reason, is that ansible has been instructed to look in /opt/rh/python27/root/usr/lib/python2.7/site-packages/setuptools/command/ for ansible modules.

It located a file named register.py in that directory, and it is causing issues with ansible.

You may have some misconfiguration that is causing this, and using ansible-config dump --only-changed may reveal the issue.

Below is the output from the command.

DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = [u’/usr/share/my_modules’, u’/opt/rh/python27/root/usr/lib/python2.7/site-packages/icontrol’, u’/usr/lib/python2.7/site-packages/ansible/utils/module_docs_fragments’]

DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u’/etc/ansible/roles’, u’/usr/share/ansible/roles’]
PARAMIKO_HOST_KEY_AUTO_ADD(/etc/ansible/ansible.cfg) = True