Created
April 5, 2021 17:11
-
-
Save IPvSean/40bbcd85591352d6fd48e8677571e437 to your computer and use it in GitHub Desktop.
bgp example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: convert configured BGP resource to structured data | |
hosts: junos | |
vars: | |
inventory_dir: "lab_inventory" | |
inventory_hostname: "junos" | |
gather_facts: false | |
tasks: | |
- name: Use the bgp_global resource module to gather the current config | |
junipernetworks.junos.junos_bgp_global: | |
state: gathered | |
register: bgp_global | |
- name: Create inventory directory | |
file: | |
path: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}" | |
state: directory | |
- name: Write the BGP GLOBAL configuration to a file | |
copy: | |
content: "{{ {'bgp_global': bgp_global['gathered']} | to_nice_yaml }}" | |
dest: "{{ inventory_dir }}/host_vars/{{ inventory_hostname }}/bgp_global.yaml" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment