Hi @rohitthakur2590 , @AAYUSH2091 ,
only way to pass the host parameter to junos_package module is via the provider option, but as per documentation "provider is deprecated https://docs.ansible.com/projects/ansible/latest/collections/junipernetworks/junos/junos_package_module.html
As per documentation - https://docs.ansible.com/projects/ansible/latest/network/user_guide/platform_junos.html, I validated using ssh_config/proxy without provider, it failed with: [ERROR]: Task failed: You must provide either 'host' or 'sock_fd' value
user1@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos$ ssh -F ./customsshconfig user1@xx.xx.xx.xx "hostname"
Warning: Permanently added 'xx.x.xx.xx.xx' (ECDSA) to the list of known hosts.
Warning: Permanently added 'xx.xx.xx.xx' (ECDSA) to the list of known hosts.
evoeventtesta
user1@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos$ cat inventory_proxy
[junos]
xx.xx.xx.xx
[junos:vars]
ansible_connection=ansible.netcommon.netconf
ansible_network_os=junipernetworks.junos.junos
[all:vars]
ansible_python_interpreter=/usr/bin/python3
root@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos# cat pb.juniper_junos_package_mod2.yml
user1@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos$ ansible-playbook -i inventory_proxy pb.juniper_junos_package_mod2.yml
[WARNING]: Ansible is being run in a world writable directory (/home/user1/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos), ignoring it as an ansible.cfg source. For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
PLAY [Functional Test - junos_package module] ****************************************************************************************
TASK [Install local package on remote device] ****************************************************************************************
[WARNING]: Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: junipernetworks.junos.junos has been deprecated. The junipernetworks.junos collection is deprecated. Use the juniper.device collection instead.
Redirects will be removed after 2028-04-01. Update your playbooks to use juniper.device FQCNs. This feature will be removed from collection 'junipernetworks.junos' in a release after 2028-04-01.
[DEPRECATION WARNING]: Importing 'to_native' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[DEPRECATION WARNING]: Importing 'to_text' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[ERROR]: Task failed: You must provide either 'host' or 'sock_fd' value
Origin: /home/user1/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos/pb.juniper_junos_package_mod2.yml:8:7
6
7 tasks:
8 - name: Install local package on remote device
^ column 7
fatal: [xx.xx.xx.xx]: FAILED! => {"changed": false, "msg": "Task failed: You must provide either 'host' or 'sock_fd' value"}
PLAY RECAP ***************************************************************************************************************************
xx.xx.xx.xx : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Hi @rohitthakur2590 , @AAYUSH2091 ,
only way to pass the host parameter to junos_package module is via the provider option, but as per documentation "provider is deprecated https://docs.ansible.com/projects/ansible/latest/collections/junipernetworks/junos/junos_package_module.html
As per documentation - https://docs.ansible.com/projects/ansible/latest/network/user_guide/platform_junos.html, I validated using ssh_config/proxy without provider, it failed with: [ERROR]: Task failed: You must provide either 'host' or 'sock_fd' value
user1@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos$ ssh -F ./customsshconfig user1@xx.xx.xx.xx "hostname"
Warning: Permanently added 'xx.x.xx.xx.xx' (ECDSA) to the list of known hosts.
Warning: Permanently added 'xx.xx.xx.xx' (ECDSA) to the list of known hosts.
evoeventtesta
user1@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos$ cat inventory_proxy
[junos]
xx.xx.xx.xx
[junos:vars]
ansible_connection=ansible.netcommon.netconf
ansible_network_os=junipernetworks.junos.junos
[all:vars]
ansible_python_interpreter=/usr/bin/python3
root@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos# cat pb.juniper_junos_package_mod2.yml
name: Functional Test - junos_package module
hosts: all
gather_facts: false
collections:
tasks:
name: Install local package on remote device
juniper.device.junos_package:
src: /var/tmp/junos-x86-64-24.1R1.5.tgz
reboot: false
no_copy: true
version: 24.1R1.5
register: result_install
name: Wait for device to come back online after reboot (TCP check)
wait_for:
host: xx.xx.xx.xx
port: 830
delay: 30
timeout: 300
name: Wait until NETCONF service is ready (SSH banner check)
wait_for:
host: xx.xx.xx.xx
port: 830
search_regex: "SSH"
timeout: 300
delay: 10
sleep: 5
register: wait_result
until: wait_result is succeeded
retries: 10
delay: 10
name: Assert install task ran
assert:
that:
- result_install is defined
user1@masterhost:~/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos$ ansible-playbook -i inventory_proxy pb.juniper_junos_package_mod2.yml
[WARNING]: Ansible is being run in a world writable directory (/home/user1/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos), ignoring it as an ansible.cfg source. For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
PLAY [Functional Test - junos_package module] ****************************************************************************************
TASK [Install local package on remote device] ****************************************************************************************
[WARNING]: Deprecation warnings can be disabled by setting
deprecation_warnings=Falsein ansible.cfg.[DEPRECATION WARNING]: junipernetworks.junos.junos has been deprecated. The junipernetworks.junos collection is deprecated. Use the juniper.device collection instead.
Redirects will be removed after 2028-04-01. Update your playbooks to use juniper.device FQCNs. This feature will be removed from collection 'junipernetworks.junos' in a release after 2028-04-01.
[DEPRECATION WARNING]: Importing 'to_native' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[DEPRECATION WARNING]: Importing 'to_text' from 'ansible.module_utils._text' is deprecated. This feature will be removed from ansible-core version 2.24. Use ansible.module_utils.common.text.converters instead.
[ERROR]: Task failed: You must provide either 'host' or 'sock_fd' value
Origin: /home/user1/ansible_collection_release5/ansible-junos-stdlib/tests/junipernetworks_junos/pb.juniper_junos_package_mod2.yml:8:7
6
7 tasks:
8 - name: Install local package on remote device
^ column 7
fatal: [xx.xx.xx.xx]: FAILED! => {"changed": false, "msg": "Task failed: You must provide either 'host' or 'sock_fd' value"}
PLAY RECAP ***************************************************************************************************************************
xx.xx.xx.xx : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0