Could it be that you're mixing a virtualenv with OS package provided modules...?
On Sat, 8 Dec 2018 at 00:03, <[email protected]> wrote:
>
> 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 <module>
> _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 <module>
> 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 <module>
> 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 <module>\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 <module>\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 <module>\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 ^[^#] 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
> ---
> - name: Load and generate a configuration and push to a device running Junos 
> OS
> gather_facts: no
> connection: local
> hosts: LAB
> roles:
> - Juniper.Junos
> vars_prompt:
> - name: netconf_user
> prompt: Username
> private: no
> - name: netconf_password
> prompt: Password
> private: yes
> gather_facts: no
> vars:
> credentials:
> host: "{{ inventory_hostname }}"
> port: 830
> username: "{{ netconf_user }}"
> password: "{{ netconf_password }}"
>
> tasks:
> - name: load configure file into device
> juniper_junos_config:
> provider: "{{ credentials }}"
> src: "/home/jnaughton/network-ansible/ansible/lab.set"
> comment: Updated by Ansible
>
> # - name: load configure file into device
> # junos_install_config:
> # host={{ inventory_hostname }}
> # file=/home/jnaughton/network-ansible/ansible/{{ inventory_hostname }}.set
>
>
> And the roles directory look correct
> p-mon01{jnaughton}~/network-ansible/ansible [1023] $ ls 
> /home/jnaughton/.ansible/roles
> Juniper.Junos
> #####################
> p-mon01{jnaughton}~/.ansible/roles/Juniper.Junos/action_plugins [1039] $ ls 
> -la
> total 48
> drwxrwxr-x 2 jnaughton jnaughton 4096 Nov 27 10:24 .
> drwxrwxr-x 10 jnaughton jnaughton 4096 Nov 19 16:49 ..
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_command.py -> 
> juniper_junos_common_action.py
> -rwxrwxr-x 1 jnaughton jnaughton 2308 Jun 1 05:17 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_config.py -> 
> juniper_junos_common_action.py
> -rw-rw-r-- 1 jnaughton jnaughton 657 Nov 27 10:24 juniper_junos_config.pyc
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_facts.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_jsnapy.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_ping.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_pmtud.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_rpc.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_software.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_srx_cluster.py 
> -> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_system.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 juniper_junos_table.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_cli.py -> 
> juniper_junos_common_action.py
> -rwxrwxr-x 1 jnaughton jnaughton 3124 Jun 1 05:17 _junos_commit.py
> -rwxrwxr-x 1 jnaughton jnaughton 3039 Jun 1 05:17 _junos_get_config.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_get_facts.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_get_table.py -> 
> juniper_junos_common_action.py
> -rwxrwxr-x 1 jnaughton jnaughton 4138 Jun 1 05:17 _junos_install_config.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_install_os.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_jsnapy.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_ping.py -> 
> juniper_junos_common_action.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_pmtud.py -> 
> juniper_junos_common_action.py
> -rwxrwxr-x 1 jnaughton jnaughton 3206 Jun 1 05:17 _junos_rollback.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_rpc.py -> 
> juniper_junos_common_action.py
> -rwxrwxr-x 1 jnaughton jnaughton 4253 Jun 1 05:17 _junos_shutdown.py
> lrwxrwxrwx 1 jnaughton jnaughton 30 Nov 19 16:49 _junos_srx_cluster.py -> 
> juniper_junos_common_action.py
> -rwxrwxr-x 1 jnaughton jnaughton 3311 Jun 1 05:17 _junos_zeroize.py
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/51164413-bdff-40b1-8fea-2f607cc1b3bb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwOnYPXp6aR7m23KaVDJUY2hS8FhuWmDUVGy8BC%3D5fTY7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to