ansible-collections / junipernetworks.junos

Ansible Network Collection for Juniper JunOS
GNU General Public License v3.0
82 stars 63 forks source link

Issue with junos_package module #437

Closed achrstl closed 11 months ago

achrstl commented 1 year ago
SUMMARY

Unable to use the junipernetworks.junos.junos_package module. Same as https://github.com/ansible-collections/junipernetworks.junos/issues/347

ISSUE TYPE
COMPONENT NAME
ANSIBLE VERSION

Package               Version
--------------------- -------
ansible               8.2.0
ansible-core          2.15.2
bcrypt                4.0.1
cffi                  1.15.1
cryptography          41.0.3
future                0.18.3
Jinja2                3.1.2
junos-eznc            2.6.7
lxml                  4.9.3
MarkupSafe            2.1.3
ncclient              0.6.13
netaddr               0.8.0
netmiko               4.2.0
ntc-templates         3.5.0
packaging             23.1
paramiko              3.3.1
pip                   23.0.1
pycparser             2.21
PyNaCl                1.5.0
pyparsing             3.1.1
pyserial              3.5
PyYAML                6.0.1
resolvelib            1.0.1
scp                   0.14.5
setuptools            65.5.0
six                   1.16.0
textfsm               1.1.3
transitions           0.9.0
yamlordereddictloader 0.4.0
COLLECTION VERSION
Collection                    Version
----------------------------- -------
amazon.aws                    6.2.0
ansible.netcommon             5.1.2
ansible.posix                 1.5.4
ansible.utils                 2.10.3
ansible.windows               1.14.0
arista.eos                    6.0.1
awx.awx                       22.5.0
azure.azcollection            1.16.0
check_point.mgmt              5.1.1
chocolatey.chocolatey         1.5.1
cisco.aci                     2.6.0
cisco.asa                     4.0.1
cisco.dnac                    6.7.3
cisco.intersight              1.0.27
cisco.ios                     4.6.1
cisco.iosxr                   5.0.3
cisco.ise                     2.5.12
cisco.meraki                  2.15.3
cisco.mso                     2.4.0
cisco.nso                     1.0.3
cisco.nxos                    4.4.0
cisco.ucs                     1.9.0
cloud.common                  2.1.3
cloudscale_ch.cloud           2.3.1
community.aws                 6.1.0
community.azure               2.0.0
community.ciscosmb            1.0.6
community.crypto              2.14.1
community.digitalocean        1.23.0
community.dns                 2.5.7
community.docker              3.4.8
community.fortios             1.0.0
community.general             7.2.0
community.google              1.0.0
community.grafana             1.5.4
community.hashi_vault         5.0.0
community.hrobot              1.8.1
community.libvirt             1.2.0
community.mongodb             1.6.1
community.mysql               3.7.2
community.network             5.0.0
community.okd                 2.3.0
community.postgresql          2.4.2
community.proxysql            1.5.1
community.rabbitmq            1.2.3
community.routeros            2.8.3
community.sap                 1.0.0
community.sap_libs            1.4.1
community.skydive             1.0.0
community.sops                1.6.4
community.vmware              3.8.0
community.windows             1.13.0
community.zabbix              2.1.0
containers.podman             1.10.2
cyberark.conjur               1.2.0
cyberark.pas                  1.0.19
dellemc.enterprise_sonic      2.2.0
dellemc.openmanage            7.6.1
dellemc.powerflex             1.7.0
dellemc.unity                 1.7.0
f5networks.f5_modules         1.25.0
fortinet.fortimanager         2.2.0
fortinet.fortios              2.3.0
frr.frr                       2.0.2
gluster.gluster               1.0.2
google.cloud                  1.2.0
grafana.grafana               2.1.4
hetzner.hcloud                1.16.0
hpe.nimble                    1.1.4
ibm.qradar                    2.1.0
ibm.spectrum_virtualize       1.12.0
infinidat.infinibox           1.3.12
infoblox.nios_modules         1.5.0
inspur.ispim                  1.3.0
inspur.sm                     2.3.0
junipernetworks.junos         5.2.0
kubernetes.core               2.4.0
lowlydba.sqlserver            2.0.0
microsoft.ad                  1.2.0
netapp.aws                    21.7.0
netapp.azure                  21.10.0
netapp.cloudmanager           21.22.0
netapp.elementsw              21.7.0
netapp.ontap                  22.7.0
netapp.storagegrid            21.11.1
netapp.um_info                21.8.0
netapp_eseries.santricity     1.4.0
netbox.netbox                 3.13.0
ngine_io.cloudstack           2.3.0
ngine_io.exoscale             1.0.0
ngine_io.vultr                1.1.3
openstack.cloud               2.1.0
openvswitch.openvswitch       2.1.1
ovirt.ovirt                   3.1.2
purestorage.flasharray        1.20.0
purestorage.flashblade        1.12.1
purestorage.fusion            1.5.0
sensu.sensu_go                1.13.2
servicenow.servicenow         1.0.6
splunk.es                     2.1.0
t_systems_mms.icinga_director 1.33.1
theforeman.foreman            3.12.0
vmware.vmware_rest            2.3.1
vultr.cloud                   1.8.0
vyos.vyos                     4.1.0
wti.remote                    1.0.5
CONFIGURATION
CONFIG_FILE() = None
EDITOR(env: EDITOR) = vim
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
PAGER(env: PAGER) = less
OS / ENVIRONMENT

Python 3.10.12

STEPS TO REPRODUCE
---
- name: Upgrade Junos for bugfix
  hosts: all
  collections:
    - junipernetworks.junos.junos
  gather_facts: no
  connection: local

  tasks:
    - name: Upgrade Junos
      junipernetworks.junos.junos_package:
        src: /var/tmp/junos.tgz
        reboot: true
      register: out
    - debug: msg="{{ out }}"
EXPECTED RESULTS
ACTUAL RESULTS
  File "/Users/user/.pyenv/lib/python3.10/site-packages/jnpr/junos/device.py", line 1263, in __init__
    raise ValueError("You must provide either 'host' or 'sock_fd' value")
ValueError: You must provide either 'host' or 'sock_fd' value
achrstl commented 1 year ago

Also tested with

Python               3.7.3
ansible               4.10.0
ansible-core          2.11.12
junipernetworks.junos         2.8.0
achrstl commented 11 months ago

Found the issue, provider is marked as deprecated in the doc but is a mandatory parameter.

- name: Install Junos and reboot
  junipernetworks.junos.junos_package:
    src: /var/tmp/junos.tgz
    reboot: true
    no_copy: true
    provider:
      host: "{{ inventory_hostname }}"
      username: "{{ ansible_user }}"
      password: "{{ ansible_password }}"