Execution
Date 08 Dec 2025 13:27:39 +0000
Duration 00:05:33.94
Controller aio1.openstack.local
User root
Versions
Ansible 2.18.6
ara 1.7.4 / 1.7.4
Python 3.12.3
Summary
2 Hosts
316 Tasks
313 Results
18 Plays
136 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
  listen: Restart systemd-networkd
  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

- 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"