Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate systemd unit files #10597

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/container-engine/containerd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
src: containerd.service.j2
dest: /etc/systemd/system/containerd.service
mode: 0644
validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:containerd.service'"
# FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
# Remove once we drop support for systemd < 250
notify: Restart containerd

- name: Containerd | Ensure containerd directories exist
Expand Down
3 changes: 3 additions & 0 deletions roles/container-engine/cri-dockerd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:{{ item }}'"
# FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
# Remove once we drop support for systemd < 250
with_items:
- cri-dockerd.service
- cri-dockerd.socket
Expand Down
6 changes: 6 additions & 0 deletions roles/etcd/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
dest: /etc/systemd/system/etcd.service
backup: yes
mode: 0644
# FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
# Remove once we drop support for systemd < 250
validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:etcd-{{ etcd_deployment_type }}.service'"
when: is_etcd_master and etcd_cluster_setup

- name: Configure | Copy etcd-events.service systemd file
Expand All @@ -59,6 +62,9 @@
dest: /etc/systemd/system/etcd-events.service
backup: yes
mode: 0644
validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:etcd-events-{{ etcd_deployment_type }}.service'"
# FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
# Remove once we drop support for systemd < 250
when: is_etcd_master and etcd_events_cluster_setup

- name: Configure | reload systemd
Expand Down
3 changes: 3 additions & 0 deletions roles/kubernetes/control-plane/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
mode: 0644
validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:{{item}}'"
# FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
# Remove once we drop support for systemd < 250
with_items:
- k8s-certs-renew.service
- k8s-certs-renew.timer
Expand Down
3 changes: 3 additions & 0 deletions roles/kubernetes/node/tasks/kubelet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
dest: "/etc/systemd/system/kubelet.service"
backup: "yes"
mode: 0600
validate: "sh -c '[ -f /usr/bin/systemd/system/factory-reset.target ] || exit 0 && systemd-analyze verify %s:kubelet.service'"
# FIXME: check that systemd version >= 250 (factory-reset.target was introduced in that release)
# Remove once we drop support for systemd < 250
notify: Node | restart kubelet
tags:
- kubelet
Expand Down