import error: No module named plugins.action.normal

Hi All,

When we attempt to use Ansible on a bare metal server running centos 6.5, single python2.7 the “juniper_junos_config:” module gives us this error “import error: No module named plugins.action.normal”. This works fine on another Ubuntu server. I hope someone here may have some thoughts on what is wrong.

p-mon01{jnaughton}~/network-ansible/ansible [1038] $ ansible-playbook -i hosts-lab playbooks/lab-push.pb.yaml -vvv
ansible-playbook 2.7.0
config file = /home/jnaughton/network-ansible/ansible/ansible.cfg
configured module search path = [u’/home/jnaughton/network-ansible/ansible/modules’]
ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 2.7.14 (default, Oct 19 2018, 14:48:27) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
Using /home/jnaughton/network-ansible/ansible/ansible.cfg as config file
Parsed /home/jnaughton/network-ansible/ansible/hosts-lab inventory source with ini plugin

PLAYBOOK: lab-push.pb.yaml *************************************************************************************************
1 plays in playbooks/lab-push.pb.yaml
Username: labtech
Password:

PLAY [Load and generate a configuration and push to a device running Junos OS] *********************************************
META: ran handlers

TASK [load configure file into device] *************************************************************************************
task path: /home/jnaughton/network-ansible/ansible/playbooks/lab-push.pb.yaml:24
<10.95.7.5> ESTABLISH LOCAL CONNECTION FOR USER: jnaughton
<10.95.7.5> EXEC /bin/sh -c ‘echo ~jnaughton && sleep 0’
<10.95.7.5> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379” && echo ansible-tmp-1543333736.61-164598744816379=“echo /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379” ) && sleep 0’
Using module file /home/jnaughton/.ansible/roles/Juniper.Junos/library/juniper_junos_config.py
<10.95.7.5> PUT /home/jnaughton/.ansible/tmp/ansible-local-229118drPfu/tmpjeSXDq TO /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py
<10.95.7.5> EXEC /bin/sh -c ‘chmod u+x /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/ /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py && sleep 0’
<10.95.7.5> EXEC /bin/sh -c ‘/usr/bin/python /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py && sleep 0’
<10.95.7.5> EXEC /bin/sh -c ‘rm -f -r /home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/ > /dev/null 2>&1 && sleep 0’
The full traceback is:
Traceback (most recent call last):
File “/home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py”, line 113, in
_ansiballz_main()
File “/home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py”, line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File “/home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py”, line 48, in invoke_module
imp.load_module(‘main’, mod, module, MOD_DESC)
File “/tmp/ansible_juniper_junos_config_payload_rUnJEK/main.py”, line 741, in
File “/tmp/ansible_juniper_junos_config_payload_rUnJEK/ansible_juniper_junos_config_payload.zip/ansible/module_utils/juniper_j nos_common.py”, line 40, in
ImportError: No module named plugins.action.normal
fatal: [10.95.7.5]: FAILED! => {
“changed”: false,
“module_stderr”: “Traceback (most recent call last):\n File "/home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py", line 113, in \n _ansiballz_main()\n File "/home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/jnaughton/.ansible/tmp/ansible-tmp-1543333736.61-164598744816379/AnsiballZ_juniper_junos_config.py", line 48, in invoke_module\n imp.load_module(‘main’, mod, module, MOD_DESC)\n File "/tmp/ansible_juniper_junos_config_payload_rUnJEK/main.py", line 741, in \n File "/tmp/ansible_juniper_junos_config_payload_rUnJEK/ansible_juniper_junos_config_payload.zip/ansible/module_utils/juniper_junos_comm on.py", line 40, in \nImportError: No module named plugins.action.normal\n”,
“module_stdout”: “”,
“msg”: “MODULE FAILURE\nSee stdout/stderr for the exact error”,
“rc”: 1
}

PLAY RECAP *****************************************************************************************************************
10.95.7.5 : ok=0 changed=0 unreachable=0 failed=1

The Juniper.Junos role is installed:

p-mon01{jnaughton}~/network-ansible/ansible [1039] $ ansible-galaxy list

  • Juniper.Junos, 2.1.0
    p-mon01{jnaughton}~/network-ansible/ansible [1040] $ ansible-galaxy Juniper.Junos info

Role: Juniper.Junos
description: Network build automation of Junos devices.
active: True
commit: 019573cc435cd7c8c6eb54cce286cce1209d7b91
commit_message: Merge pull request #372 from rsmekala/master

Prepare the 2.1.0 release
commit_url: https://github.com/Juniper/ansible-junos-stdlib/commit/019573cc435cd7c8c6eb54cce286cce1209d7b91
company: Juniper Networks, Inc.
created: 2016-02-26T11:54:40.759806Z
dependencies:
download_count: 61453
forks_count: 117
galaxy_info:
author: Juniper
categories: [‘networking’]
company: Juniper Networks, Inc.
galaxy_tags: [‘networking’, ‘junos’, ‘juniper’]
license: Apache 2.0
min_ansible_version: 2.1
platforms: [{‘name’: ‘junos’, ‘versions’: [‘all’]}]
github_branch: master
github_repo: ansible-junos-stdlib
github_user: Juniper
id: 8138
imported: 2018-06-01T05:42:42.847519-04:00
install_date: Mon Nov 19 21:49:07 2018
intalled_version: 2.1.0
is_valid: True
issue_tracker_url: https://github.com/Juniper/ansible-junos-stdlib/issues
license: Apache 2.0
min_ansible_version: 2.1
modified: 2018-06-30T05:11:19.035846Z
open_issues_count: 26
path: [u’/home/jnaughton/.ansible/roles’]
role_type: ANS
stargazers_count: 197
travis_status_url:

Here is the Ansible config file
p-mon01{jnaughton}~/network-ansible/ansible [1022] $ grep [1] ansible.cfg
[defaults]
inventory = hosts
library = ./modules
forks = 50
ansible_python_interpreter = /usr/local/bin/python ← this looks correct
gathering = smart
roles_path = /home/jnaughton/.ansible/roles
host_key_checking = False
fact_caching = jsonfile
fact_caching_timeout = 86400
fact_caching_connection = /tmp
retry_files_enabled = False
[privilege_escalation]
[paramiko_connection]
[ssh_connection]
[accelerate]
[selinux]
[colors]
highlight = white
verbose = blue
warn = bright purple
error = red
debug = dark gray
deprecate = purple
skip = cyan
unreachable = red
ok = green
changed = yellow
diff_add = green
diff_remove = red
diff_lines = cyan

The Python version looks correct.
p-mon01{jnaughton}~ [1005] $ which python
/usr/local/bin/python
p-mon01{jnaughton}~ [1006] $ python
Python 2.7.14 (default, Oct 19 2018, 14:48:27)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import jnpr.junos
jnpr.junos.version
‘2.2.0’
quit()

The playbook
p-mon01{jnaughton}~/network-ansible/ansible/playbooks [1017] $ cat lab-push.pb.yaml


  1. ^# ↩︎

Could it be that you're mixing a virtualenv with OS package provided modules...?

Hi Dick,

No we are not using the virtualenv tool.