firewall: use a handler to reboot

This commit is contained in:
Timotej Lazar 2024-05-19 10:09:37 +02:00
parent 0e9dac6985
commit 668af8bdb6
2 changed files with 8 additions and 14 deletions

View file

@ -6,6 +6,10 @@
command: mkinitfs command: mkinitfs
when: "'handler' not in ansible_skip_tags" when: "'handler' not in ansible_skip_tags"
- name: reboot
reboot:
when: "'handler' not in ansible_skip_tags"
- name: reload frr - name: reload frr
command: /usr/lib/frr/frr-reload.py --reload /etc/frr/frr.conf command: /usr/lib/frr/frr-reload.py --reload /etc/frr/frr.conf
when: "'handler' not in ansible_skip_tags" when: "'handler' not in ansible_skip_tags"

View file

@ -3,23 +3,13 @@
dest: /etc/network/interfaces.d/mgmt.intf dest: /etc/network/interfaces.d/mgmt.intf
src: mgmt.intf.j2 src: mgmt.intf.j2
mode: 0644 mode: 0644
register: task_mgmt_interface notify: reboot
- name: Run SSH in management VRF - name: Run SSH in management VRF
lineinfile: lineinfile:
path: /etc/conf.d/sshd path: /etc/conf.d/sshd
regexp: "#* *vrf="
line: "vrf=\"mgmt\"" line: "vrf=\"mgmt\""
register: task_ssh_vrf notify: reboot
- name: Reboot for new VRF - meta: flush_handlers
reboot:
when: task_mgmt_interface.changed or task_ssh_vrf.changed
register: task_reboot
- name: Reset the connection
meta: reset_connection
- name: Wait for the network device to reload
wait_for_connection:
delay: 10
when: task_reboot.changed