diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-07 23:58:44 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-07 23:58:44 +0200 |
commit | 18133a7854edec361f7699af0662027d527be540 (patch) | |
tree | d0f1751739076e6927397c0b754a98d968983c07 /ansible/bgp/bgp.yml | |
parent | 6967e11d9c14554300e07fd70a6a93ffe224f8d3 (diff) | |
download | infra-18133a7854edec361f7699af0662027d527be540.tar.gz infra-18133a7854edec361f7699af0662027d527be540.tar.bz2 infra-18133a7854edec361f7699af0662027d527be540.tar.xz infra-18133a7854edec361f7699af0662027d527be540.zip |
bgp setup
Diffstat (limited to 'ansible/bgp/bgp.yml')
-rw-r--r-- | ansible/bgp/bgp.yml | 51 |
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 |