Добавить ansible.yml

This commit is contained in:
2026-03-22 21:16:49 +03:00
parent 779e4af771
commit 1e6ea1fcc1

67
ansible.yml Normal file
View File

@@ -0,0 +1,67 @@
---
- hosts: all
become: true
vars:
ip_address:
R01:
- 10.10.1.1/24
- 10.20.1.1/24
- 10.100.1.1/24
R02:
- 10.10.1.2/24
- 10.30.1.1/24
- 10.200.1.1/24
R03:
- 10.20.1.2/24
- 10.30.1.2/24
R04:
- 10.100.1.2/24
R05:
- 10.100.2.2/24
tasks:
- name: update
apt:
update_cache: yes
- name: install frr
apt:
name: frr
state: present
- name: enable ospfd
lineinfile:
path: /etc/frr/daemons
regexp: '^ospfd='
line: 'ospfd=yes'
notify: restart frr
- name: copy template frr conf
template:
src: frr.template
dest: /etc/frr/frr.conf
notify: restart frr
- name: deploy files ansible_conf_frr
include_tasks: ansible_conf_frr.yml
loop: "{{ ip_address[inventory_hostname] }}"
- name: enable ospf frr
blockinfile:
path: /etc/frr/frr.conf
block: |
!
router ospf
network 10.0.0.0/8 area 0
exit
marker: ""
notify: restart frr
handlers:
- name: restart frr
systemd:
name: frr
state: restarted