Skip to content

Commit

Permalink
Fix permanently enabling systemd-networkd
Browse files Browse the repository at this point in the history
Work around the service module not yet handling "enabled-runtime"
properly. This patch should be reverted when the following can be used:
ansible/ansible#77754
  • Loading branch information
MoteHue committed Jul 15, 2024
1 parent 0286a36 commit cd49c82
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions roles/systemd_networkd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,20 @@
- ansible_facts.distribution | lower == 'debian'
- ansible_facts.distribution_major_version >= '12'

- name: Enable systemd-networkd
become: true
ansible.builtin.service:
name: systemd-networkd
enabled: true
- block:

Check failure on line 18 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

key-order[task]

You can improve the task key order to: when, block

Check failure on line 18 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

name[missing]

All tasks should be named.
# TODO(mattcrees): Remove once this gets into a versioned release:
# https://github.com/ansible/ansible/pull/77754
- name: Temporarily disable systemd-networkd

Check failure on line 21 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

fqcn[action-core]

Use FQCN for builtin module actions (service).

Check failure on line 21 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

yaml[indentation]

Wrong indentation: expected 4 but found 2
become: true
service:
name: systemd-networkd
enabled: no

Check failure on line 25 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

yaml[truthy]

Truthy value should be one of \[false, true]

- name: enable systemd-networkd

Check failure on line 27 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

fqcn[action-core]

Use FQCN for builtin module actions (service).

Check failure on line 27 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

name[casing]

All names should start with an uppercase letter.
become: true
service:
name: systemd-networkd
enabled: yes

Check failure on line 31 in roles/systemd_networkd/tasks/main.yml

View workflow job for this annotation

GitHub Actions / lint / Ansible 2.14 lint

yaml[truthy]

Truthy value should be one of \[false, true]
when: systemd_networkd_network or systemd_networkd_link or systemd_networkd_netdev

- name: Start and enable systemd-resolved
Expand Down

0 comments on commit cd49c82

Please sign in to comment.