Closed
Description
SUMMARY
Module statirng with junos_* within a role fails to load with import error
ISSUE TYPE
- Bug Report
COMPONENT NAME
plugins/action/junos.py
ANSIBLE VERSION
2.9
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
Create a role with below structure
$tree
.
├── ansible.cfg
├── roles
│ └── network
│ ├── README.md
│ ├── bindep.txt
│ ├── defaults
│ │ └── main.yml
│ ├── handlers
│ │ └── main.yml
│ ├── library
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ ├── junos_facts.py
│ │ └── junos_interfaces.py
│ ├── meta
│ │ └── main.yml
│ ├── module_utils
│ │ ├── __init__.py
│ │ └── network
│ │ ├── __init__.py
│ │ └── junos
│ │ ├── __init__.py
│ │ ├── argspec
│ │ │ ├── __init__.py
│ │ │ ├── facts
│ │ │ │ ├── __init__.py
│ │ │ │ └── facts.py
│ │ │ └── interfaces
│ │ │ ├── __init__.py
│ │ │ └── interfaces.py
│ │ ├── config
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ └── interfaces
│ │ │ ├── __init__.py
│ │ │ └── interfaces.py
│ │ ├── facts
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── facts.py
│ │ │ └── interfaces
│ │ │ ├── __init__.py
│ │ │ └── interfaces.py
│ │ └── utils
│ │ ├── __init__.py
│ │ └── utils.py
│ ├── tasks
│ │ └── main.yml
│ ├── test-requirements.txt
│ ├── tests
│ │ ├── inventory
│ │ └── test.yml
│ ├── tox.ini
│ └── vars
│ └── main.yml
└── test_facts.yaml
---
- hosts: junos
connection: network_cli
gather_facts: no
tasks:
- name: import network role
import_role:
name: network
- name: get interfaces facts
junos_facts:
gather_network_resources:
- interfaces
EXPECTED RESULTS
Should invoke the junos module within role without any error.
ACTUAL RESULTS
$ansible-playbook test_facts.yaml
PLAY [junos] *****************************************************************************************
TASK [get interfaces facts] **************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named facts.facts
fatal: [junos02]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}
PLAY RECAP *******************************************************************************************
junos02 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0