Ansible/Jinja2/Juniper

27 views
Skip to first unread message

Saurav Gupta

unread,
Oct 8, 2021, 12:51:07 AM10/8/21
to Ansible Development
Hi everyone,

I am very new to Ansible and automation.  i ma trying to run below playbook and getting related error. 

---
- name:  Generic
  hosts: mx
  roles:
   - Juniper.junos
  connection:  local
  gather_facts:  no
  vars_files:
   -  jun_snm.yml
  tasks:

     - name: SNMP
       juniper_junos_config:
          load: "set"
          src: jun_snmp.j2
        
       register: response
      
     - name: "Print"
       debug:
         var: response.diff_lines

jun_snmp.j2
{% for snm in snmp_clients -%}
set snmp community r3adth1s clients {{ snm }}
{% endfor %}
jun_snm.yml
---
snmp_clients:
      - 10.60.3.249/32
      - 10.60.3.250/32
      - 10.60.3.251/32
      - 10.60.3.254/32
      - 10.60.4.249/32

Below is error i am getting 
fatal: [MX960_A]: FAILED! => {"changed": false, "msg": "Failure loading the configuraton: ConfigLoadError(severity: error, bad_element: {%, message: error: unknown command\nerror: invalid ip address or hostname: {{\nerror: unknown command)"}

Can you please advise.

Thanks
Reply all
Reply to author
Forward
0 new messages