summaryrefslogtreecommitdiff
path: root/ansible/bgp/bgp.yml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/bgp/bgp.yml')
-rw-r--r--ansible/bgp/bgp.yml51
1 files changed, 51 insertions, 0 deletions
diff --git a/ansible/bgp/bgp.yml b/ansible/bgp/bgp.yml
new file mode 100644
index 0000000..4c7787a
--- /dev/null
+++ b/ansible/bgp/bgp.yml
@@ -0,0 +1,51 @@
+- hosts:
+ - akili
+ - arius
+ - astyanax
+ - hash
+ - knot
+ tasks:
+ - debug:
+ msg: "Hello World!"
+
+ - debug:
+ var: bgp_if
+
+ - debug:
+ var: bgp_peers
+
+ - ansible.utils.update_fact:
+ updates:
+ - path: "peers[{{ idx }}]"
+ value: "{{ {} }}"
+ - path: "peers[{{ idx }}].name"
+ value: "{{ item }}"
+ - path: "peers[{{ idx }}].as"
+ value: "{{ hostvars[item].bgp_as }}"
+ - path: "peers[{{ idx }}].ip"
+ value: "{{ hostvars[item].bgp_ip }}"
+ loop: "{{ bgp_peers }}"
+ loop_control:
+ index_var: idx
+ vars:
+ peers: []
+ register: out
+ changed_when: false
+
+ - set_fact:
+ peers: "{{ out.results[-1].peers }}"
+
+ - debug:
+ var: peers
+
+ - become: yes
+ template:
+ src: bird.conf.j2
+ dest: /etc/bird/bird.conf
+ register: template
+
+ - systemd:
+ state: restarted
+ service: bird
+ when: template.changed
+ become: yes