diff --git a/roles/dhcp-server/handlers/main.yml b/roles/dhcp-server/handlers/main.yml index f6d4d46..3815964 100644 --- a/roles/dhcp-server/handlers/main.yml +++ b/roles/dhcp-server/handlers/main.yml @@ -7,3 +7,20 @@ - name: restart network-manager command: "/bin/systemctl restart NetworkManager.service" + +- name: reboot + when: ansible_connection != 'local' + command: shutdown -r now "Reboot triggered by Ansible" + async: 0 + poll: 0 + ignore_errors: true + +- name: wait for reboot + when: ansible_connection != 'local' + local_action: + module: wait_for + host: "{{ inventory_hostname }}" + port: "{{ ansible_port | default(22) }}" + delay: 1 + timeout: 300 + sudo: false diff --git a/roles/dhcp-server/tasks/main.yml b/roles/dhcp-server/tasks/main.yml index 4499352..c0b7dc3 100644 --- a/roles/dhcp-server/tasks/main.yml +++ b/roles/dhcp-server/tasks/main.yml @@ -7,6 +7,9 @@ template: src: templates/76-netnames.rules.j2 dest: /etc/udev/rules.d/76-netnames.rules + notify: + - reboot + - wait for reboot - name: configure network interfaces (static) template: