pip install junos-eznc
Populate the addresses of the Juniper routers:
hosts
file, located at the root of this repository.Provide the credentials information to reach the devices:
credentials.yml
file, located at \group_vars\vmxPrepare the Jinja2 files for the template module to use them:
bgp.j2
file, located in the plabook directorty: \junos_templateProvide the variables information, to be used in the Jinja2 tempalting to render the configurations:
bgp.yaml
file, located in \host_vars\vmx1bgp.yaml
file, located in \host_vars\vmx2Write the playbook:
pb.bgp.2.yml
file, located at \junos_template\Run the playbook (First run):
mab@mab-infra:~/automation/ansible/junos_template$ sudo ansible-playbook pb.bgp.2.yml
[DEPRECATION WARNING]: junos_template is kept for backwards compatibility but usage is discouraged. The module documentation details
page may explain more about this rationale..
This feature will be removed in a future release. Deprecation warnings can be disabled
by setting deprecation_warnings=False in ansible.cfg.
PLAY [create BGP junos configuration] **
TASK [Render BGP configuration for junos devices] ** ok: [vmx1] ok: [vmx2]
TASK [push bgp configuration on devices] *** changed: [vmx1] changed: [vmx2]
PLAY [wait for peers to establish connections] *****
TASK [pause] *** Pausing for 25 seconds (ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort) ok: [localhost]
PLAY [check bgp states] ****
TASK [check bgp peers states] ** ok: [vmx2] => (item={u'interface': u'ge-0/0/0', u'local_ip': u'172.16.0.40', u'asn': 101, u'name': u'to vmx1', u'peer_ip': u'172.16.0.30'}) ok: [vmx1] => (item={u'interface': u'ge-0/0/0', u'local_ip': u'172.16.0.30', u'asn': 102, u'name': u'to vmx2', u'peer_ip': u'172.16.0.40'})
PLAY RECAP *****
localhost : ok=1 changed=0 unreachable=0 failed=0
vmx1 : ok=3 changed=1 unreachable=0 failed=0
vmx2 : ok=3 changed=1 unreachable=0 failed=0
- Run the playbook again (second run, to check idempotency):
mab@mab-infra:~/automation/ansible/junos_template$ sudo ansible-playbook pb.bgp.2.yml [DEPRECATION WARNING]: junos_template is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale.. This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
PLAY [create BGP junos configuration] **
TASK [Render BGP configuration for junos devices] ** ok: [vmx1] ok: [vmx2]
TASK [push bgp configuration on devices] *** ok: [vmx2] ok: [vmx1]
PLAY [wait for peers to establish connections] *****
TASK [pause] *** Pausing for 25 seconds (ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort) ok: [localhost]
PLAY [check bgp states] ****
TASK [check bgp peers states] ** ok: [vmx2] => (item={u'interface': u'ge-0/0/0', u'local_ip': u'172.16.0.40', u'asn': 101, u'name': u'to vmx1', u'peer_ip': u'172.16.0.30'}) ok: [vmx1] => (item={u'interface': u'ge-0/0/0', u'local_ip': u'172.16.0.30', u'asn': 102, u'name': u'to vmx2', u'peer_ip': u'172.16.0.40'})
PLAY RECAP *****
localhost : ok=1 changed=0 unreachable=0 failed=0
vmx1 : ok=3 changed=0 unreachable=0 failed=0
vmx2 : ok=3 changed=0 unreachable=0 failed=0
### Example 2:
## Getting Started with Arista modules:
### Example 1: configure BGP between two routers.
### Example 2: