From 9f04949ba0ed029fffe455283bd583e124e4d2fd Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 8 Dec 2021 17:37:14 +0100 Subject: [PATCH] container: align systemd units with rpm Update `After=` and `Wants=` parameters in container systemd units and make them be aligned with the systemd units that come from the packaging. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2027440 Signed-off-by: Guillaume Abrioux (cherry picked from commit f01536ea195a56c3ea2b31c7232391387e909c41) --- roles/ceph-crash/templates/ceph-crash.service.j2 | 5 +++-- roles/ceph-grafana/templates/grafana-server.service.j2 | 5 +++-- roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 | 5 +++-- roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 | 5 +++-- roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 | 5 +++-- roles/ceph-mds/templates/ceph-mds.service.j2 | 5 +++-- roles/ceph-mgr/templates/ceph-mgr.service.j2 | 5 +++-- roles/ceph-mon/templates/ceph-mon.service.j2 | 5 +++-- roles/ceph-nfs/templates/ceph-nfs.service.j2 | 5 +++-- roles/ceph-node-exporter/templates/node_exporter.service.j2 | 5 +++-- roles/ceph-osd/templates/ceph-osd.service.j2 | 5 +++-- roles/ceph-prometheus/templates/alertmanager.service.j2 | 5 +++-- roles/ceph-prometheus/templates/prometheus.service.j2 | 5 +++-- roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 | 5 +++-- roles/ceph-rgw/templates/ceph-radosgw.service.j2 | 5 +++-- 15 files changed, 45 insertions(+), 30 deletions(-) diff --git a/roles/ceph-crash/templates/ceph-crash.service.j2 b/roles/ceph-crash/templates/ceph-crash.service.j2 index 61b8740bc..578675d1d 100644 --- a/roles/ceph-crash/templates/ceph-crash.service.j2 +++ b/roles/ceph-crash/templates/ceph-crash.service.j2 @@ -1,11 +1,12 @@ [Unit] Description=Ceph crash dump collector {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] {% if container_binary == 'podman' %} diff --git a/roles/ceph-grafana/templates/grafana-server.service.j2 b/roles/ceph-grafana/templates/grafana-server.service.j2 index da82bd586..27c8d8a79 100644 --- a/roles/ceph-grafana/templates/grafana-server.service.j2 +++ b/roles/ceph-grafana/templates/grafana-server.service.j2 @@ -3,11 +3,12 @@ [Unit] Description=grafana-server {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 b/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 index f480c7a07..6baf1293f 100644 --- a/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 +++ b/roles/ceph-iscsi-gw/templates/rbd-target-api.service.j2 @@ -1,11 +1,12 @@ [Unit] Description=RBD Target API Service {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 b/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 index 0b3a04936..754a22d0a 100644 --- a/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 +++ b/roles/ceph-iscsi-gw/templates/rbd-target-gw.service.j2 @@ -1,11 +1,12 @@ [Unit] Description=RBD Target Gateway Service {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 b/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 index d35917f87..c0dae539a 100644 --- a/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 +++ b/roles/ceph-iscsi-gw/templates/tcmu-runner.service.j2 @@ -1,11 +1,12 @@ [Unit] Description=TCMU Runner {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-mds/templates/ceph-mds.service.j2 b/roles/ceph-mds/templates/ceph-mds.service.j2 index c79300443..59338e8fa 100644 --- a/roles/ceph-mds/templates/ceph-mds.service.j2 +++ b/roles/ceph-mds/templates/ceph-mds.service.j2 @@ -2,11 +2,12 @@ Description=Ceph MDS PartOf=ceph-mds.target {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target {% set cpu_limit = ansible_facts['processor_vcpus']|int if ceph_mds_docker_cpu_limit|int > ansible_facts['processor_vcpus']|int else ceph_mds_docker_cpu_limit|int %} [Service] diff --git a/roles/ceph-mgr/templates/ceph-mgr.service.j2 b/roles/ceph-mgr/templates/ceph-mgr.service.j2 index dd8a18a20..338fbe793 100644 --- a/roles/ceph-mgr/templates/ceph-mgr.service.j2 +++ b/roles/ceph-mgr/templates/ceph-mgr.service.j2 @@ -2,11 +2,12 @@ Description=Ceph Manager PartOf=ceph-mgr.target {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-mon/templates/ceph-mon.service.j2 b/roles/ceph-mon/templates/ceph-mon.service.j2 index abbf6ebba..891e7ea6f 100644 --- a/roles/ceph-mon/templates/ceph-mon.service.j2 +++ b/roles/ceph-mon/templates/ceph-mon.service.j2 @@ -2,11 +2,12 @@ Description=Ceph Monitor PartOf=ceph-mon.target {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-nfs/templates/ceph-nfs.service.j2 b/roles/ceph-nfs/templates/ceph-nfs.service.j2 index 5d735e1fe..41d360262 100644 --- a/roles/ceph-nfs/templates/ceph-nfs.service.j2 +++ b/roles/ceph-nfs/templates/ceph-nfs.service.j2 @@ -2,11 +2,12 @@ Description=NFS-Ganesha file server Documentation=http://github.com/nfs-ganesha/nfs-ganesha/wiki {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-node-exporter/templates/node_exporter.service.j2 b/roles/ceph-node-exporter/templates/node_exporter.service.j2 index 346c84e62..a253d6522 100644 --- a/roles/ceph-node-exporter/templates/node_exporter.service.j2 +++ b/roles/ceph-node-exporter/templates/node_exporter.service.j2 @@ -3,11 +3,12 @@ [Unit] Description=Node Exporter {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-osd/templates/ceph-osd.service.j2 b/roles/ceph-osd/templates/ceph-osd.service.j2 index dd8295385..c0bb78fd2 100644 --- a/roles/ceph-osd/templates/ceph-osd.service.j2 +++ b/roles/ceph-osd/templates/ceph-osd.service.j2 @@ -3,11 +3,12 @@ Description=Ceph OSD PartOf=ceph-osd.target {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target {% set cpu_limit = ansible_facts['processor_vcpus']|int if ceph_osd_docker_cpu_limit|int > ansible_facts['processor_vcpus']|int else ceph_osd_docker_cpu_limit|int %} [Service] diff --git a/roles/ceph-prometheus/templates/alertmanager.service.j2 b/roles/ceph-prometheus/templates/alertmanager.service.j2 index a621c8a76..bad5fbd6e 100644 --- a/roles/ceph-prometheus/templates/alertmanager.service.j2 +++ b/roles/ceph-prometheus/templates/alertmanager.service.j2 @@ -3,11 +3,12 @@ [Unit] Description=alertmanager {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] WorkingDirectory={{ alertmanager_data_dir }} diff --git a/roles/ceph-prometheus/templates/prometheus.service.j2 b/roles/ceph-prometheus/templates/prometheus.service.j2 index 8202cf22e..e8a92c0f9 100644 --- a/roles/ceph-prometheus/templates/prometheus.service.j2 +++ b/roles/ceph-prometheus/templates/prometheus.service.j2 @@ -3,11 +3,12 @@ [Unit] Description=prometheus {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 index 847e05f0f..22e6b49ec 100644 --- a/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 +++ b/roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2 @@ -2,11 +2,12 @@ Description=Ceph RBD mirror PartOf=ceph-rbd-mirror.target {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target [Service] EnvironmentFile=-/etc/environment diff --git a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 index 31a40606a..7d1c37371 100644 --- a/roles/ceph-rgw/templates/ceph-radosgw.service.j2 +++ b/roles/ceph-rgw/templates/ceph-radosgw.service.j2 @@ -2,11 +2,12 @@ Description=Ceph RGW PartOf=ceph-radosgw.target {% if container_binary == 'docker' %} -After=docker.service +After=docker.service network-online.target local-fs.target time-sync.target Requires=docker.service {% else %} -After=network.target +After=network-online.target local-fs.target time-sync.target {% endif %} +Wants=network-online.target local-fs.target time-sync.target {% set cpu_limit = ansible_facts['processor_vcpus']|int if ceph_rgw_docker_cpu_limit|int > ansible_facts['processor_vcpus']|int else ceph_rgw_docker_cpu_limit|int %} [Service]