ansible-infra/ansible_collections/debops/debops/roles/ifupdown/tasks/ifup_systemd.yml
Stefan Bethke 2aed20393f
Some checks failed
/ Ansible Lint (push) Failing after 5m45s
/ Ansible Lint (pull_request) Failing after 4m59s
Vendor Galaxy Roles and Collections
2026-02-06 22:07:16 +01:00

44 lines
1.4 KiB
YAML

---
# Copyright (C) 2015-2017 Maciej Delmanowski <drybjed@gmail.com>
# Copyright (C) 2015-2017 Robin Schneider <ypid@riseup.net>
# Copyright (C) 2015-2017 DebOps <https://debops.org/>
# SPDX-License-Identifier: GPL-3.0-only
- name: Check systemd version
ansible.builtin.shell: set -o nounset -o pipefail -o errexit && systemd --version | head -n 1 | awk '{print $2}'
args:
executable: 'bash'
register: ifupdown__register_systemd_version
check_mode: False
changed_when: False
- name: Install custom ifupdown services
ansible.builtin.template:
src: 'etc/systemd/system/{{ item }}.j2'
dest: '/etc/systemd/system/{{ item }}'
owner: 'root'
group: 'root'
mode: '0644'
with_items:
- 'iface@.service'
- 'ifup-wait-all-auto.service'
- 'ifup-allow-boot.service'
register: ifupdown__register_systemd_services
- name: Reload systemd services
ansible.builtin.systemd: # noqa no-handler
daemon_reload: True
when: ifupdown__register_systemd_services is changed
## https://stackoverflow.com/a/28888474
- name: Test if Ansible is running in check mode
ansible.builtin.command: /bin/true
changed_when: False
register: ifupdown__register_check_mode
- name: Enable custom ifupdown services
ansible.builtin.service:
name: '{{ item }}'
enabled: True
with_items: [ 'ifup-wait-all-auto', 'ifup-allow-boot' ]
when: ifupdown__register_check_mode is not skipped