>
>
>
> [WARNING]: log file at /var/log/ansible.log is not writeable and we cannot 
> create it, aborting
> ansible 2.4.3.0
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [u'/usr/share/my_modules']
>   ansible python module location = 
> /usr/local/lib/python2.7/dist-packages/ansible
>   executable location = /usr/local/bin/ansible
>   python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 
> 20160609]
>
> --------------------------------------------------
>
# This is the file that generate .cfg file from template. 
# /etc/ansible/leaf_bgp/tasks/cfg_generator.yaml  
# this file will be called form /etc/ansible/sudo ansible-playbook 
spine.yml -vvvv 

> ---
>  - name: Clear gathered facts from all currently targeted hosts
>    meta: refresh_inventory
>
>  - name: Generating LEAF-BGP configuration
>    template:
>       src="/etc/ansible/leaf_bgp/templates/leaf_bgp_template.j2"
>       dest=/etc/ansible/leaf_bgp/files/{{item.host_ip}}_leaf_bgp.cfg
>    when:
>       - item.host_ip |string  in 
> hostvars[inventory_hostname].inventory_hostname
>    with_items:
>      - "{{ leaf_bgp }}"
> #     - "{{ all_vars }}"
>
> ----------------------------------------------------
>
#This file is /etc/ansible/bgp_leaf/defaults/main.yaml
# I am trying to access these variables for all routers of junos
#these are common variables for all routers  

> ---
> # defaults file for leaf_bgp
> all_vars:
>   [
>   local_as : '65111',
>   peer_as : '65101',
>   evpn_as : '65100',
>   spine_lo0 : '172.21.0.11',
>   ]
>

# I tried lot of different ways like
# Still not able to access the variables from this defaults/main.yaml file 
# I am getting same error as "AnsibleUndefinedVariable: 'dict object' has 
no attribute 

>
> ---------------------------------------------------------------------------------------------------------------
>
# This is /etc/ansible/bgp_leaf/vars/main.yaml
# When i have all variables here my script is running fine. It is 
generating .cfg file. But I want to access some variable from 
/defaults/main.yaml 

> #Vars file
> leaf_bgp:                                                                  
>                              
>                                                                           
>                                 
>    #4_Member Leaf TOA                                                      
>                                
>                                                                           
>                                 
>    - {'host_ip' : '135.182.175.7',                                        
>                                 
>       'host_name' : 'something',                                          
>                               
>       'loopback0' : '172.21.0.1',                                          
>                                
>                                                                           
>                                 
>       'spine_neighbor' : '10.11.1.1',                                      
>                                
>       'spinev6_neighbor' : 'Something',                                    
>               
>                                                                           
>                                 
>      }     
>
> -----------------------------------------------
>
>
> The error is  "msg": "AnsibleUndefinedVariable: 'dict object' has no 
> attribute 'local_as'"
>
> Please solve
>
> I tried changing differnt formats  
----------------------------------------
#This file is /etc/ansible/bgp_leaf/defaults/main.yaml
# I am trying to access these variables for all routers of junos
#these are common variables for all routers  
---
# defaults file for leaf_bgp
local_as : '65111',
peer_as : '65101',
evpn_as : '65100',
spine_lo0 : '172.21.0.11',
-------------------------------------------------------
#This file is /etc/ansible/bgp_leaf/defaults/main.yaml
# I am trying to access these variables for all routers of junos
#these are common variables for all routers  
---
# defaults file for leaf_bgp
{
 'local_as' : '65111',
 'peer_as' : '65101',
 'evpn_as' : '65100',
 'spine_lo0' : '172.21.0.11',
}
-------------------------------------------------------------
#This file is /etc/ansible/bgp_leaf/defaults/main.yaml
# I am trying to access these variables for all routers of junos
#these are common variables for all routers  
---
# defaults file for leaf_bgp
'local_as' : '65111',
'peer_as' : '65101',
'evpn_as' : '65100',
'spine_lo0' : '172.21.0.11',
---------------------------------------------------------------

Please do the needful 

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2dfcff0c-a197-44f3-ae91-e8a5a29845e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to