add capability to disable systemd-resolved to base_config role
All checks were successful
/ Ansible Lint (push) Successful in 2m28s
/ Ansible Lint (pull_request) Successful in 2m24s

This commit is contained in:
lilly 2026-04-30 23:12:08 +02:00
commit 58ced1a85e
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g
9 changed files with 131 additions and 0 deletions

View file

@ -0,0 +1,36 @@
---
- name: Deploy systemd-resolved config
tags: [ "deploy_systemd_resolved_config" ]
become: true
notify: "reload systemd-resolved"
ansible.builtin.template:
src: resolved.conf.j2
dest: /etc/systemd/resolved.conf
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Make /etc/resolv.conf points to systemd-resolved
tags: [ "deploy_systemd_resolved_config" ]
become: true
when: deploy_systemd_resolved_config__mode != "extern"
ansible.builtin.file: # noqa: jinja
path: /etc/resolv.conf
state: link
force: true
src: >-
{%- if deploy_systemd_resolved_config__mode == "stub" -%}
/run/systemd/resolve/stub-resolv.conf
{%- elif deploy_systemd_resolved_config__mode == "static-stub" -%}
/usr/lib/systemd/resolv.conf
{%- elif deploy_systemd_resolved_config__mode == "passthru" -%}
/run/systemd/resolve/resolv.conf
{%- endif -%}
- name: Ensure systemd-resolved is running and enabled
tags: [ "deploy_systemd_resolved_config" ]
become: true
ansible.builtin.systemd:
name: systemd-resolved.service
state: started
enabled: true