Execution
Date 14 Dec 2025 10:04:43 +0000
Duration 00:10:10.66
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.13.5
Summary
15 Hosts
603 Tasks
2357 Results
18 Plays
157 Files
0 Records

File: /home/zuul/src/opendev.org/openstack/ansible-role-systemd_networkd/handlers/main.yml

---
# 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: Ensure required services are running
  ansible.builtin.systemd:
    name: "{{ item }}"
    state: started
    enabled: true
    masked: false
  with_items:
    - dbus
    - systemd-udevd
    - systemd-udev-trigger
  listen:
    - Restart systemd-networkd
    - Restart systemd-udev
  when:
    - systemd_networkd_distro_packages | length > 0

- name: Restart systemd-networkd
  ansible.builtin.systemd:
    name: "systemd-networkd"
    state: restarted
    enabled: "yes"
  async: 45
  poll: 0
  when:
    - systemd_run_networkd | bool
  listen: Restart systemd-networkd
  tags:
    - systemd-networkd

# NOTE: Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=2406525
- name: Clean-up systemd-udev override for EL
  ansible.builtin.file:
    path: /usr/lib/systemd/system/systemd-udev-trigger.service.d/systemd-udev-trigger-no-reload.conf
    state: absent
  listen:
    - Restart systemd-udev
  register: systemd_udev_trigger_no_reload
  when:
    - systemd_run_networkd | bool
    - ansible_facts['os_family'] | lower == 'redhat'

- name: Restart systemd-udev
  ansible.builtin.systemd:
    name: systemd-udev-trigger
    state: restarted
    daemon_reload: "{{ systemd_udev_trigger_no_reload.changed | bool }}"
  when:
    - systemd_run_networkd | bool

- name: (RE)Gather facts post setup
  ansible.builtin.setup:
    gather_subset: "network,hardware,virtual"
  listen: Restart systemd-networkd

- name: Restart systemd-resolved
  ansible.builtin.systemd:
    name: "systemd-resolved"
    state: restarted
    enabled: "yes"
  tags:
    - systemd-networkd
    - systemd-resolved

- name: Update initramfs
  ansible.builtin.command: "{{ systemd_networkd_update_initramfs }}" # noqa: no-changed-when
  when:
    - ansible_facts['virtualization_type'] != "systemd-nspawn"
    - ansible_facts['virtualization_type'] != "lxc"
    - ansible_facts['virtualization_type'] != "lxd"
    - ansible_facts['virtualization_type'] != "podman"
    - ansible_facts['virtualization_type'] != "docker"
    - ansible_facts['virtualization_type'] != "systemd_container"
    - ansible_facts['virtualization_type'] != "container"