I have launched empty Ubuntu 16.04 system and installed ansible & required 
ansible modules in following way:
---------
sudo su
apt-get install python-pip
apt-get install python-dev libxml2-dev libxslt-dev libssl-dev    libffi-dev
pip install junos-eznc
apt-get install ansible
ansible-galaxy install Juniper.junos  
ansible-galaxy install --roles-path . Juniper.jenkins
ansible-galaxy install --roles-path /etc/ansible/roles Juniper.jenkins
ansible-galaxy install Juniper.jenkins
pip install -U jxmlease
pip install ncclient
-----------
Possibly is it required to install additional packages for ansible?

Ansible project (ansible.cfg, hosts, test2.yml) has been installed in three 
different directories: /ets/ansible, /root/.ansible ; 
/root/Project_22.01.2018

Now each time when I run playbook from different directories I receive the 
same error output:

------------
root@Jenkins:~/Project_22.01.2018# /usr/bin/ansible-playbook test2.yml -f 1 
--private-key ~/.ssh/id_rsa -u root -vvvvv
Using /root/Project_22.01.2018/ansible.cfg as config file
Loaded callback jsnapy of type aggregate, v2.0
Loaded callback default of type stdout, v2.0
1 plays in test2.yml

PLAY [GET] 
*********************************************************************

TASK [CHECK-NETCONF] 
***********************************************************
task path: /root/Project_22.01.2018/test2.yml:14
ESTABLISH LOCAL CONNECTION FOR USER: root
10.10.10.11 EXEC mkdir -p "$( echo 
$HOME/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332 )" && echo "$( 
echo $HOME/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332 )"
10.10.10.11 PUT /tmp/tmpukU7TW TO 
/root/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332/wait_for
10.10.10.11 EXEC LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 
LC_MESSAGES=en_US.UTF-8 /usr/bin/python 
/root/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332/wait_for; rm 
-rf "/root/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332/" > 
/dev/null 2>&1
ok: [10.10.10.11] => {"changed": false, "elapsed": 0, "invocation": 
{"module_args": {"connect_timeout": 5, "delay": 0, "exclude_hosts": null, 
"host": "10.219.167.11", "path": null, "port": "830", "search_regex": null, 
"state": "started", "timeout": "5"}, "module_name": "wait_for"}, "path": 
null, "port": 830, "search_regex": null, "state": "started"}

TASK [Retrive information from devices running Junos OS] 
***********************
task path: /root/Project_22.01.2018/test2.yml:17
fatal: [10.10.10.11]: FAILED! => {"failed": true, "msg": "ERROR! the 
handler 'juniper_junos_facts' was not found"}

PLAY RECAP 
*********************************************************************
10.10.10.11              : ok=1    changed=0    unreachable=0    failed=1
------------

Here is my test ansible project:
root@Jenkins:~/Project_22.01.2018# pwd
/root/Project_22.01.2018
root@Jenkins:~/Project_22.01.2018# ll
total 60
drwxr-xr-x 5 root root  4096 Feb  1 14:56 ./
drwx------ 7 root root  4096 Feb  1 14:56 ../
-rw-r--r-- 1 root root   338 Feb  1 14:56 ansible.cfg
drwxr-xr-x 8 root root  4096 Feb  1 14:46 .git/
-rw-r--r-- 1 root root    69 Feb  1 14:46 hosts
drwxr-xr-x 4 root root  4096 Feb  1 14:46 roles/
-rw-r--r-- 1 root root   567 Feb  1 14:46 test2.yml
root@Jenkins:~/Project_22.01.2018#

------- ansible.cfg
[defaults]
inventory=./hosts
remote_user=root
ask_pass=False
transport = netconf
host_key_checking = False
roles_path = 
/etc/ansible/roles:/root/.ansible/roles:/root/Project_22.01.2018/roles
library = 
/etc/ansible/roles/Juniper.junos/library:/root/.ansible/roles/Juniper.junos/library:/root/Project_22.01.2018/roles/Juniper.junos/library
--------- hosts
[vsrx]
10.219.167.11 ansible_ssh_user=root ansible_connection=local
--------- test2.yml
---
- name: GET
  hosts: vsrx
  roles:
  - Juniper.junos
  connection: local
  gather_facts: no
  vars:
    ansible_python_interpreter: /usr/bin/python

  # Execute tasks (plays) this way "ansible-playbook <path>/GET.yml --tags 
<tag-name>"
  tasks:
  # Check if a device is NETCONF-aware
  - name: CHECK-NETCONF
    wait_for: host={{ inventory_hostname }} port=830 timeout=5

  - name: Retrive information from devices running Junos OS
    juniper_junos_facts:
      host: "{{ inventory_hostname }}"
    register: junos

  - name: version
    debug:
      var: junos
----------------

-- 
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/6159a7bd-2cdf-4abb-b898-3eed5bfdeaaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to