]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
container: use tmpfiles.d to creates /run/ceph
authorGuillaume Abrioux <gabrioux@redhat.com>
Sun, 10 Feb 2019 07:21:43 +0000 (08:21 +0100)
committerSébastien Han <seb@redhat.com>
Wed, 13 Feb 2019 08:42:27 +0000 (09:42 +0100)
instead of using `RuntimeDirectory` parameter in systemd unit files,
let's use a systemd `tmpfiles.d` to ensure `/run/ceph`.

Explanation:

`podman` doesn't create the `/var/run/ceph` if it doesn't exist the time
where the container is run while `docker` used to create it.
In case of `switch_to_containers` scenario, `/run/ceph` gets created by
a tmpfiles.d systemd file; when switching to containers, the systemd
unit file complains because `/run/ceph` already exists

The better fix would be to ensure `/usr/lib/tmpfiles.d/ceph-common.conf`
is removed and only rely on `RuntimeDirectory` from systemd unit file parameter
but we come from a non-containerized environment which is already running,
it means `/run/ceph` is already created and when starting the unit to
start the container, systemd will still complain and we can't simply
remove the directory if daemons are collocated.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-container-common/tasks/pre_requisites/prerequisites.yml
roles/ceph-mds/templates/ceph-mds.service.j2
roles/ceph-mgr/templates/ceph-mgr.service.j2
roles/ceph-mon/templates/ceph-mon.service.j2
roles/ceph-nfs/templates/ceph-nfs.service.j2
roles/ceph-osd/templates/ceph-osd.service.j2
roles/ceph-rbd-mirror/templates/ceph-rbd-mirror.service.j2
roles/ceph-rgw/templates/ceph-radosgw.service.j2

index bfa04ef8886815786fcf82d381f28731cde866ea..d6601d12d8bb50418c44cede64ddbda00e2d81a7 100644 (file)
         with_pkg
   when:
     - ansible_os_family == 'RedHat'
-    - ansible_distribution_major_version == '8'
\ No newline at end of file
+    - ansible_distribution_major_version == '8'
+
+- name: ensure tmpfiles.d is present
+  lineinfile:
+    path: /usr/lib/tmpfiles.d/ceph-common.conf
+    line: "d /run/ceph 0770 ceph ceph -"
+    owner: root
+    group: root
+    mode: 0644
+    state: present
index 9569175008bc10fd5823597d604b5d9010a7f2b2..38c4b1691e61796f96952766d52f525715145e37 100644 (file)
@@ -4,7 +4,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=-/etc/environment
-RuntimeDirectory=ceph
 ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mds-{{ ansible_hostname }}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mds-{{ ansible_hostname }}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
index e52a68ac3c014f57125d6a5f9af4bb7310d73f60..889862051e57d0b4913a0b475a3045978990ed86 100644 (file)
@@ -4,7 +4,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=-/etc/environment
-RuntimeDirectory=ceph
 ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-mgr-{{ ansible_hostname }}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mgr-{{ ansible_hostname }}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
index 8485e23b0f876982c6b81f093e5fe1db8ac1ac89..79718a15f8ac110106df472de16baef24aa01990 100644 (file)
@@ -4,7 +4,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=-/etc/environment
-RuntimeDirectory=ceph
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-mon-%i
 ExecStartPre=/bin/sh -c '"$(command -v mkdir)" -p /etc/ceph /var/lib/ceph/mon'
 ExecStart=/usr/bin/{{ container_binary }} run --rm --name ceph-mon-%i \
index 8e57e2dcc68375efa0f9c720e483caebbcc02fa8..82cc61759e4c1c6be48eebabe1b8a4ac64deafec 100644 (file)
@@ -5,7 +5,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=-/etc/environment
-RuntimeDirectory=ceph
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-nfs-%i
 ExecStartPre=/usr/bin/mkdir -p /etc/ceph /etc/ganesha /var/lib/nfs/ganesha
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
index 8e775661c386dec3ee7caf24497bb4c00d7fe3dd..fc46baf11d966beb95660faef6b1141eb6b11dca 100644 (file)
@@ -5,7 +5,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=-/etc/environment
-RuntimeDirectory=ceph
 {% if osd_scenario == 'lvm' -%}
 ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-osd-%i
 ExecStartPre=-/usr/bin/{{ container_binary }} rm -f ceph-osd-%i
index 0073e17b6f3fc45325e761dcb9659e910209f038..a25633c0a5e24eb6222089c1a909b530d22fbe64 100644 (file)
@@ -4,7 +4,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=-/etc/environment
-RuntimeDirectory=ceph
 ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rbd-mirror-{{ ansible_hostname }}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-rbd-mirror-{{ ansible_hostname }}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \
index 0a69f544a91a29e78e11ad796295a593236e53a0..1e05a8cec9ed1f86879c4314ce26ce237ac51fe3 100644 (file)
@@ -4,7 +4,6 @@ After=docker.service
 
 [Service]
 EnvironmentFile=/var/lib/ceph/radosgw/ceph-%i/EnvironmentFile
-RuntimeDirectory=ceph
 ExecStartPre=-/usr/bin/{{ container_binary }} stop ceph-rgw-{{ ansible_hostname }}-${INST_NAME}
 ExecStartPre=-/usr/bin/{{ container_binary }} rm ceph-rgw-{{ ansible_hostname }}-${INST_NAME}
 ExecStart=/usr/bin/{{ container_binary }} run --rm --net=host \