Hi, I am trying to configure a Junos QFX 10002 device with the following steps :
1. Creating a ".set" config file and saving the same at location "/tmp/<hostname>.set".
2. Try to login into the device via juniper. device.config role and trying to load the config task detail are :
======================================================================
Task
======================================================================
- name: Loading Configuration File
hosts: all
connection: local
gather_facts: no
vars:
user: "{{ user }}"
passwd: "{{ password }}"
tasks:
- name: "retrive facts"
juniper.device.facts:
savedir: "{{ playbook_dir }}"
register: response
- name: "Merge Config data"
juniper.device.config:
load: "set"
src: "/tmp/{{ inventory_hostname }}.set"
diff: true
check_commit_wait: 10
confirmed: 5
comment: "updated using Ansible"
ignore_warning: true
register: result
=============================================================
First task in name
"retrive facts" is running fine and giving data as expected but second task name
"Merge Config data" is not running and during the config load only it is giving the below error (Error logs attached below)
I also tried different combinations of module_args like changing different values for "Load:" and "format:", but it doesn't help.
What I understood from this is we can't load the ".set" file with "load:" argument value as "set".....Is this True?
Could you please help me with how I can resolve this...
Constraint: We have to use the ".set" config file only as per our project requirement.
=============================================================
Error Log
==================================================================
[2022-01-24 - 21:05:08.902] §
[2022-01-24 - 21:05:08.902] §TASK [Merge Config data] *****************************************************************************
[2022-01-24 - 21:05:08.903] §task path: :303
[2022-01-24 - 21:05:08.903] §<host_ip> ESTABLISH LOCAL CONNECTION FOR USER: root
[2022-01-24 - 21:05:08.903] §<host_ip> EXEC /bin/sh -c 'echo ~root && sleep 0'
[2022-01-24 - 21:05:08.903] §<host_ip> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864 `" && echo ansible-tmp-1643038549.8358123-19753-46485499002864="` echo /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864 `" ) && sleep 0'
[2022-01-24 - 21:05:08.904] §Using module file /root/.ansible/collections/ansible_collections/juniper/device/plugins/modules/config.py
[2022-01-24 - 21:05:08.920] §<host_ip> PUT /root/.ansible/tmp/ansible-local-19680x06ne54z/tmppusa6h3v TO /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864/AnsiballZ_config.py
[2022-01-24 - 21:05:08.936] §<host_ip> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864/ /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864/AnsiballZ_config.py && sleep 0'
[2022-01-24 - 21:05:08.956] §<host_ip> EXEC /bin/sh -c '/usr/local/ansible-python/bin/python /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864/AnsiballZ_config.py && sleep 0'
[2022-01-24 - 21:05:10.115] §<host_ip> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1643038549.8358123-19753-46485499002864/ > /dev/null 2>&1 && sleep 0'
[2022-01-24 - 21:05:10.233] §The full traceback is:
[2022-01-24 - 21:05:10.233] § File "/tmp/ansible_juniper.device.config_payload_y_ohe21k/ansible_juniper.device.config_payload.zip/ansible_collections/juniper/device/plugins/module_utils/juniper_junos_common.py", line 1468, in load_configuration
[2022-01-24 - 21:05:10.233] § self.config.load(**load_args)
[2022-01-24 - 21:05:10.233] § File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/utils/config.py", line 589, in load
[2022-01-24 - 21:05:10.233] § return try_load(rpc_contents, rpc_xattrs, ignore_warning=ignore_warning)
[2022-01-24 - 21:05:10.233] § File "/usr/local/lib/python3.8/dist-packages/jnpr/junos/utils/config.py", line 506, in try_load
[2022-01-24 - 21:05:10.233] § raise ConfigLoadError(cmd=err.cmd, rsp=err.rsp, errs=err.errs)
[2022-01-24 - 21:05:10.233] §fatal: [hostname]: FAILED! => {
[2022-01-24 - 21:05:10.233] § "changed": false,
[2022-01-24 - 21:05:10.233] § "invocation": {
[2022-01-24 - 21:05:10.233] § "module_args": {
[2022-01-24 - 21:05:10.233] § "attempts": null,
[2022-01-24 - 21:05:10.233] § "baud": null,
[2022-01-24 - 21:05:10.233] § "check": true,
[2022-01-24 - 21:05:10.233] § "check_commit_wait": null,
[2022-01-24 - 21:05:10.233] § "comment": null,
[2022-01-24 - 21:05:10.234] § "commit": false,
[2022-01-24 - 21:05:10.234] § "commit_empty_changes": false,
[2022-01-24 - 21:05:10.234] § "config_mode": "exclusive",
[2022-01-24 - 21:05:10.234] § "confirmed": null,
[2022-01-24 - 21:05:10.234] § "console": null,
[2022-01-24 - 21:05:10.234] § "cs_passwd": null,
[2022-01-24 - 21:05:10.234] § "cs_user": null,
[2022-01-24 - 21:05:10.234] § "dest": null,
[2022-01-24 - 21:05:10.234] § "dest_dir": null,
[2022-01-24 - 21:05:10.234] § "diff": true,
[2022-01-24 - 21:05:10.245] § "diffs_file": null,
[2022-01-24 - 21:05:10.260] § "filter": null,
[2022-01-24 - 21:05:10.453] § "format": null,
[2022-01-24 - 21:05:10.453] § "host": "host_ip",
[2022-01-24 - 21:05:10.453] § "ignore_warning": [
[2022-01-24 - 21:05:10.453] § "True"
[2022-01-24 - 21:05:10.453] § ],
[2022-01-24 - 21:05:10.453] § "level": null,
[2022-01-24 - 21:05:10.453] § "lines": null,
[2022-01-24 - 21:05:10.453] § "load": "set",
[2022-01-24 - 21:05:10.453] § "logdir": null,
[2022-01-24 - 21:05:10.453] § "logfile": null,
[2022-01-24 - 21:05:10.453] § "mode": null,
[2022-01-24 - 21:05:10.453] § "model": null,
[2022-01-24 - 21:05:10.454] § "namespace": null,
[2022-01-24 - 21:05:10.454] § "options": {},
[2022-01-24 - 21:05:10.454] § "passwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
[2022-01-24 - 21:05:10.454] § "port": 22,
[2022-01-24 - 21:05:10.454] § "remove_ns": null,
[2022-01-24 - 21:05:10.454] § "retrieve": null,
[2022-01-24 - 21:05:10.454] § "return_output": true,
[2022-01-24 - 21:05:10.454] § "rollback": null,
[2022-01-24 - 21:05:10.454] § "src": "/tmp/hostname.set",
[2022-01-24 - 21:05:10.454] § "ssh_config": null,
[2022-01-24 - 21:05:10.454] § "ssh_private_key_file": null,
[2022-01-24 - 21:05:10.454] § "template": null,
[2022-01-24 - 21:05:10.454] § "timeout": 10,
[2022-01-24 - 21:05:10.454] § "url": null,
[2022-01-24 - 21:05:10.454] § "user": "username",
[2022-01-24 - 21:05:10.454] § "vars": null
[2022-01-24 - 21:05:10.455] § }
[2022-01-24 - 21:05:10.455] § },
[2022-01-24 - 21:05:10.455] § "msg": "Failure loading the configuraton: ConfigLoadError(severity: error, bad_element: #, message: error: unknown command\nerror: unknown command\nerror: unknown command)"
[2022-01-24 - 21:05:10.455] §}
[2022-01-24 - 21:05:10.455] §
[2022-01-24 - 21:05:10.455] §PLAY RECAP *******************************************************************************************
[2022-01-24 - 21:05:10.455] §hostname : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
===================================================================
Regards