JNPRAutomate / ansible-junos-evpn-vxlan

Sample project that use Ansible and Jinja2 template to automatically generate configurations for Juniper devices deploy in EVPN/VXLAN fabric mode
MIT License
91 stars 65 forks source link

'p2p' is undefined - pb.generate.variables #47

Open ric79 opened 7 years ago

ric79 commented 7 years ago

Hello, when I run pb.generate.variables.yaml I get

TASK [generate-underlay-bgp : Generate Underlay YAML] **************************************************************************************
task path: /home/rrusso/ipfabric/roles/generate-underlay-bgp/tasks/main.yaml:3
fatal: [spine-01]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'p2p' is undefined"}
fatal: [spine-02]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'p2p' is undefined"}
fatal: [leaf-02]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'p2p' is undefined"}
fatal: [leaf-01]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'p2p' is undefined"}
fatal: [leaf-03]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'p2p' is undefined"}
fatal: [leaf-04]: FAILED! => {"changed": false, "failed": true, "msg": "AnsibleUndefinedVariable: 'p2p' is undefined"}

The error disappears when I run the playbook again. The problem is caused because "refresh_inventory" is missing in the second playbook. I think it should be:

https://github.com/JNPRAutomate/ansible-junos-evpn-vxlan/blob/master/pb.generate.variables.yaml
- name: Generate variables for underlay
  hosts: [spine, leaf]
  connection: local
  gather_facts: no
  pre_tasks:  
    - include_vars: "{{ topology_file }}"
    - meta: refresh_inventory
  roles:
    - generate-underlay-bgp

In this way, group_vars/all.yml, which was created in the first playbook, is taken into account also in the second playbook. I'm using Ansible 2.3.1.0

R