ansible-junos-stdlib
ansible-junos-stdlib copied to clipboard
ansible-lint violation: missing required arguments: _inventory_hostname, _module_name, _module_utils_path (warning)
Issue Type
- Bug Report
Module Name
juniper.device collection and Python libraries version
user@machine JunOS % ansible --version
ansible [core 2.14.3]
config file = /Users/user/JunOS/ansible.cfg
configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/7.3.0/libexec/lib/python3.11/site-packages/ansible
ansible collection location = /Users/user/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.11.2 (main, Feb 16 2023, 03:07:35) [Clang 14.0.0 (clang-1400.0.29.202)] (/usr/local/Cellar/ansible/7.3.0/libexec/bin/python3.11)
jinja version = 3.1.2
libyaml = True
user@machine JunOS % pip freeze
ansible-pylibssh==1.0.0
bcrypt==3.2.2
cffi==1.15.1
cryptography==37.0.4
Jinja2==3.1.2
junos-eznc==2.6.4
jxmlease==1.0.3
lxml==4.9.1
MarkupSafe==2.1.1
ncclient==0.6.13
netaddr==0.8.0
paramiko==2.11.0
pycparser==2.21
PyNaCl==1.5.0
pyparsing==3.0.9
pyserial==3.5
PyYAML==6.0
scp==0.14.4
six==1.16.0
transitions==0.8.11
xmltodict==0.13.0
yamlordereddictloader==0.4.0
Summary
Running ansible-lint against the playbook produces a fatal violation.
Looking at the source code of the module it seems the arguments mentioned in the violation are set to be required although they are hidden. We presume this is what's causing this issue.
Steps to reproduce
Create a playbook file with the contents below. Then run ansible-lint against the playbook file.
---
- name: NTP
hosts: all
gather_facts: false
connection: local
- name: Play
hosts: all
tasks:
- name: Set ntp
juniper.device.command:
commands:
- set date ntp 1.2.3.4
Expected results
No violations to be produced by ansible-lint
Actual results
ansible-lint produces violations
user@machine JunOS % ansible-lint linttest.yml
WARNING Listing 1 violation(s) that are fatal
args[module]: missing required arguments: _inventory_hostname, _module_name, _module_utils_path (warning)
linttest.yml:10 Task/Handler: Set ntp
Read documentation for instructions on how to ignore specific rule violations.
Rule Violation Summary
count tag profile rule associated tags
1 args[module] syntax, experimental (warning)
Passed: 0 failure(s), 1 warning(s) on 1 files. Last profile that met the validation criteria was 'production'. Rating: 5/5 star
With an up-to-date Ansible version (2.16.x) this now seems to be a fatal error during playbook execution:
TASK [Compare active to candidate configuration] ******************************************************************
task path: [...].yml:96
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: terminal) ansible.builtin.junos to junipernetworks.junos.junos
redirecting (type: cliconf) ansible.builtin.junos to junipernetworks.junos.junos
fatal: [test-ex3300]: FAILED! => {"changed": false, "msg": "missing required arguments: _inventory_hostname, _module_name, _module_utils_path"}
Edit: opened a new issue for this -> #644