Merge "Implement networkd restart as handler"

This commit is contained in:
Zuul 2018-03-21 03:09:16 +00:00 committed by Gerrit Code Review
commit a2b8fceddc
2 changed files with 32 additions and 2 deletions

24
handlers/main.yml Normal file
View File

@ -0,0 +1,24 @@
---
# Copyright 2018, Logan Vig <logan2211@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Restart systemd-networkd
systemd:
name: "systemd-networkd"
daemon_reload: yes
state: restarted
when:
- systemd_run_networkd | bool
tags:
- systemd-networkd

View File

@ -29,6 +29,8 @@
mode: "0644"
config_overrides: "{{ systemd_link_config_overrides }}"
config_type: "ini"
notify:
- Restart systemd-networkd
tags:
- systemd-networkd
@ -60,6 +62,8 @@
group: "root"
mode: "0644"
with_indexed_items: "{{ systemd_netdevs }}"
notify:
- Restart systemd-networkd
tags:
- systemd-networkd
@ -73,14 +77,16 @@
config_overrides: "{{ item.1.config_overrides | default({}) }}"
config_type: "ini"
with_indexed_items: "{{ systemd_networks }}"
notify:
- Restart systemd-networkd
tags:
- systemd-networkd
- name: Restart systemd-networkd
- name: Set systemd-networkd service state
systemd:
name: "systemd-networkd"
daemon_reload: yes
enabled: "{{ (systemd_run_networkd | bool) | ternary('yes', 'no') }}"
state: "{{ (systemd_run_networkd | bool) | ternary('restarted', omit) }}"
state: "{{ (systemd_run_networkd | bool) | ternary('started', 'stopped') }}"
tags:
- systemd-networkd