From 589d6812cae6271d72eb21781e107a8f999f0623 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 3 Mar 2017 14:58:56 +0100 Subject: [PATCH] ceph-docker: fix bootstrap directories permissions Make bootstrap directories permissions work for both RedHat and Debian os families. Signed-off-by: Guillaume Abrioux Fix: #1338 --- group_vars/docker-commons.yml.sample | 7 ++++++- roles/ceph-docker-common/defaults/main.yml | 7 ++++++- roles/ceph-docker-common/tasks/main.yml | 1 - roles/ceph-mds/tasks/docker/dirs_permissions.yml | 4 ++-- roles/ceph-mon/tasks/docker/dirs_permissions.yml | 4 ++-- roles/ceph-nfs/tasks/docker/dirs_permissions.yml | 4 ++-- roles/ceph-osd/tasks/docker/dirs_permissions.yml | 4 ++-- roles/ceph-rbd-mirror/tasks/docker/dirs_permissions.yml | 4 ++-- roles/ceph-restapi/tasks/docker/dirs_permissions.yml | 4 ++-- roles/ceph-rgw/tasks/docker/dirs_permissions.yml | 4 ++-- 10 files changed, 26 insertions(+), 17 deletions(-) diff --git a/group_vars/docker-commons.yml.sample b/group_vars/docker-commons.yml.sample index 8515116ee..56eefb621 100644 --- a/group_vars/docker-commons.yml.sample +++ b/group_vars/docker-commons.yml.sample @@ -7,7 +7,12 @@ # file as a good configuration file when no variable in it. dummy: - #ceph_docker_registry: docker.io #ceph_docker_enable_centos_extra_repo: false +# Set uid/gid to default '64045' for bootstrap directories. +# '64045' is used for debian based distros. It must be set to 167 in case of rhel based distros. +# These values have to be set according to the base OS used by the container image, NOT the host. +#bootstrap_dirs_owner: "64045" +#bootstrap_dirs_group: "64045" + diff --git a/roles/ceph-docker-common/defaults/main.yml b/roles/ceph-docker-common/defaults/main.yml index 073aec00c..395acc406 100644 --- a/roles/ceph-docker-common/defaults/main.yml +++ b/roles/ceph-docker-common/defaults/main.yml @@ -1,4 +1,9 @@ --- - ceph_docker_registry: docker.io ceph_docker_enable_centos_extra_repo: false + +# Set uid/gid to default '64045' for bootstrap directories. +# '64045' is used for debian based distros. It must be set to 167 in case of rhel based distros. +# These values have to be set according to the base OS used by the container image, NOT the host. +bootstrap_dirs_owner: "64045" +bootstrap_dirs_group: "64045" diff --git a/roles/ceph-docker-common/tasks/main.yml b/roles/ceph-docker-common/tasks/main.yml index a01824b16..357573a8b 100644 --- a/roles/ceph-docker-common/tasks/main.yml +++ b/roles/ceph-docker-common/tasks/main.yml @@ -1,7 +1,6 @@ --- - include: system_checks.yml - - name: check if it is atomic host stat: path=/run/ostree-booted register: stat_ostree diff --git a/roles/ceph-mds/tasks/docker/dirs_permissions.yml b/roles/ceph-mds/tasks/docker/dirs_permissions.yml index 7ab4d2cc8..40f159410 100644 --- a/roles/ceph-mds/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-mds/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/ diff --git a/roles/ceph-mon/tasks/docker/dirs_permissions.yml b/roles/ceph-mon/tasks/docker/dirs_permissions.yml index 5f00ecbf4..65997fd08 100644 --- a/roles/ceph-mon/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-mon/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/ diff --git a/roles/ceph-nfs/tasks/docker/dirs_permissions.yml b/roles/ceph-nfs/tasks/docker/dirs_permissions.yml index 9f07c3a71..0fc40a1ce 100644 --- a/roles/ceph-nfs/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-nfs/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/ diff --git a/roles/ceph-osd/tasks/docker/dirs_permissions.yml b/roles/ceph-osd/tasks/docker/dirs_permissions.yml index 615a36c9c..82b6d6b2b 100644 --- a/roles/ceph-osd/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-osd/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/ diff --git a/roles/ceph-rbd-mirror/tasks/docker/dirs_permissions.yml b/roles/ceph-rbd-mirror/tasks/docker/dirs_permissions.yml index 4e6510b10..0b446c639 100644 --- a/roles/ceph-rbd-mirror/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-rbd-mirror/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/ diff --git a/roles/ceph-restapi/tasks/docker/dirs_permissions.yml b/roles/ceph-restapi/tasks/docker/dirs_permissions.yml index 5f00ecbf4..65997fd08 100644 --- a/roles/ceph-restapi/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-restapi/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/ diff --git a/roles/ceph-rgw/tasks/docker/dirs_permissions.yml b/roles/ceph-rgw/tasks/docker/dirs_permissions.yml index 3d115557a..07f36cec6 100644 --- a/roles/ceph-rgw/tasks/docker/dirs_permissions.yml +++ b/roles/ceph-rgw/tasks/docker/dirs_permissions.yml @@ -3,8 +3,8 @@ file: path: "{{ item }}" state: directory - owner: "64045" - group: "64045" + owner: "{{ bootstrap_dirs_owner }}" + group: "{{ bootstrap_dirs_group }}" mode: "0755" with_items: - /etc/ceph/