From 9363665019f64240a0ed4833392707ed59c927be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 8 Mar 2016 00:40:50 +0100 Subject: [PATCH 1/2] fix fragment for osd directory scenario MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Han --- roles/ceph-osd/tasks/osd_fragment.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/roles/ceph-osd/tasks/osd_fragment.yml b/roles/ceph-osd/tasks/osd_fragment.yml index b219b6120..7c77be193 100644 --- a/roles/ceph-osd/tasks/osd_fragment.yml +++ b/roles/ceph-osd/tasks/osd_fragment.yml @@ -5,13 +5,29 @@ changed_when: false failed_when: false register: osd_path + when: not osd_directory - name: get osd id command: cat {{ item.stdout }}/whoami with_items: osd_path.results changed_when: false failed_when: false - register: osd_id + register: osd_id_non_dir_scenario + when: not osd_directory + +- name: get osd id for directory scenario + command: cat {{ item.stdout }}/whoami + with_items: osd_directories + changed_when: false + failed_when: false + register: osd_id_dir_scenario + when: osd_directory + +# NOTE (leseb): we must do this because of +# https://github.com/ansible/ansible/issues/4297 +- name: combine osd_path results + set_fact: + combined_osd_id: "{{ osd_id_non_dir_scenario if not osd_directory else osd_id_dir_scenario }}" - name: create a ceph fragment and assemble directory file: @@ -28,7 +44,7 @@ template: src: osd.conf.j2 dest: /etc/ceph/ceph.d/osd_fragments/osd.{{ item.stdout }}.conf - with_items: osd_id.results + with_items: combined_osd_id.results - name: copy ceph.conf for assembling command: cp /etc/ceph/ceph.conf /etc/ceph/ceph.d/ From 643939612745cb8815f6b1e1d65f18a9bbaab39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Tue, 8 Mar 2016 14:32:32 +0100 Subject: [PATCH 2/2] ceph-osd: fragment directory and files perms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit works for all the ceph's distros now Signed-off-by: Sébastien Han --- roles/ceph-osd/tasks/osd_fragment.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/roles/ceph-osd/tasks/osd_fragment.yml b/roles/ceph-osd/tasks/osd_fragment.yml index 7c77be193..2803588b7 100644 --- a/roles/ceph-osd/tasks/osd_fragment.yml +++ b/roles/ceph-osd/tasks/osd_fragment.yml @@ -33,9 +33,9 @@ file: path: "{{ item }}" state: directory - owner: root - group: root - mode: 0644 + owner: "{{ dir_owner }}" + group: "{{ dir_group }}" + mode: "{{ dir_mode }}" with_items: - /etc/ceph/ceph.d/ - /etc/ceph/ceph.d/osd_fragments @@ -44,6 +44,9 @@ template: src: osd.conf.j2 dest: /etc/ceph/ceph.d/osd_fragments/osd.{{ item.stdout }}.conf + owner: "{{ dir_owner }}" + group: "{{ dir_group }}" + mode: "{{ activate_file_mode }}" with_items: combined_osd_id.results - name: copy ceph.conf for assembling @@ -54,14 +57,14 @@ assemble: src: /etc/ceph/ceph.d/osd_fragments/ dest: /etc/ceph/ceph.d/osd.conf - owner: root - group: root - mode: 0644 + owner: "{{ dir_owner }}" + group: "{{ dir_group }}" + mode: "{{ activate_file_mode }}" - name: assemble ceph conf and osd fragments assemble: src: /etc/ceph/ceph.d/ dest: /etc/ceph/ceph.conf - owner: root - group: root - mode: 0644 + owner: "{{ dir_owner }}" + group: "{{ dir_group }}" + mode: "{{ activate_file_mode }}"