I have launched empty Ubuntu 16.04 system and installed ansible & required
ansible modules in following way:
========
sudo apt-get install python-pip
sudo apt-get install python-dev libxml2-dev libxslt-dev libssl-dev
libffi-dev
sudo pip install junos-eznc
apt-get install ansible
ansible-galaxy install Juniper.junos
ansible-galaxy install --roles-path /etc/ansible/roles Juniper.junos
ansible-galaxy install --roles-path . Juniper.junos
pip install -U jxmlease
pip install -U jxmlease
pip install ncclient
===========
Possible is it required installation some additional packets for ansible?
Python version is 2.7.12.
I installed test ansible project (ansible.cfg, test2.yml, hosts),
Juniper.junos module at different directories: /etc/ansible
; /root/.ansible/ ; /root/Project_22.01.2018/roles/
And now the issue is reproduced each time when I run playbook from cli.
Here is my test ansible project
------------------------
[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
------------------------
#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
----------------------------
#hosts
[vsrx]
10.10.10.11 ansible_ssh_user=root ansible_connection=local
ansible_python_interpreter=/usr/bin/python
---------------------------
---------------------------
Here is cli 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.219.167.11 EXEC mkdir -p "$( echo
$HOME/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332 )" && echo "$(
echo $HOME/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332 )"
10.219.167.11 PUT /tmp/tmpukU7TW TO
/root/.ansible/tmp/ansible-tmp-1517486840.38-200303031568332/wait_for
10.219.167.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.219.167.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.219.167.11]: FAILED! => {"failed": true, "msg": "ERROR! the
handler 'juniper_junos_facts' was not found"}
PLAY RECAP
*********************************************************************
10.219.167.11 : ok=1 changed=0 unreachable=0 failed=1
--
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/e270f49e-e4ae-4e7e-b8f5-6f25d4197b38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.