Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart networking service when interfaces changed #23

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Restart Networking service
ansible.builtin.systemd_service:
name: networking
state: restarted
6 changes: 3 additions & 3 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
hosts: all
gather_facts: false
tasks:
- name: Example assertion
ansible.builtin.assert:
that: true
- name: Example assertion
ansible.builtin.assert:
that: true
6 changes: 5 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,16 @@
dest: /etc/network/interfaces
owner: root
group: root
mode: 0644
mode: '0644'
register: config_interface
become: true
when: ifupdown_network_interfaces | length > 0
notify: Restart Networking service

- name: Flush handlers
ansible.builtin.meta: flush_handlers

- name: Restarting Network Interfaces

Check failure on line 63 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_network_interfaces }}"
Expand All @@ -65,7 +69,7 @@
item['configure'] and
config_interface['changed']

- name: Restarting Network VLANs

Check failure on line 72 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_network_vlans }}"
Expand All @@ -75,7 +79,7 @@
item['configure'] and
config_interface['changed']

- name: Restarting Network Bridges

Check failure on line 82 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_network_bridges }}"
Expand All @@ -85,7 +89,7 @@
item['configure'] and
config_interface['changed']

- name: Restarting OVS Bridges

Check failure on line 92 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_ovs_bridges }}"
Expand All @@ -95,7 +99,7 @@
item['configure'] and
config_interface['changed']

- name: Restarting OVS Bonds

Check failure on line 102 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_ovs_bonds }}"
Expand All @@ -105,7 +109,7 @@
item['configure'] and
config_interface['changed']

- name: Restarting OVS Interfaces

Check failure on line 112 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_ovs_interfaces }}"
Expand All @@ -115,7 +119,7 @@
item['configure'] and
config_interface['changed']

- name: Restarting OVS Ports

Check failure on line 122 in tasks/main.yml

View workflow job for this annotation

GitHub Actions / Run ansible-lint

no-changed-when

Commands should not change things if nothing needs doing.
ansible.builtin.shell: bash -c "ifdown {{ item.name }} --force && ifup {{ item.name }} --force"
become: true
with_items: "{{ ifupdown_ovs_ports }}"
Expand Down
Loading