From bb55860a7a688da021ba2ac916d47a706b7a89e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 25 Feb 2016 12:04:17 +0100 Subject: [PATCH 1/2] ceph-: abitlity to copy admin on all the nodes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit allows you to set a new variable to 'true' if you want to have ceph admin key copied over different kind of hosts such as MDS, OSD, RGW. To enable this just set `copy_admin_key` to true. Closes: #555 Signed-off-by: Sébastien Han --- roles/ceph-mds/defaults/main.yml | 6 ++++++ roles/ceph-mds/tasks/pre_requisite.yml | 10 ++++++++-- roles/ceph-osd/defaults/main.yml | 6 ++++++ roles/ceph-osd/tasks/pre_requisite.yml | 10 +++++++--- roles/ceph-rgw/defaults/main.yml | 6 ++++++ roles/ceph-rgw/tasks/pre_requisite.yml | 11 ++++++++--- 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/roles/ceph-mds/defaults/main.yml b/roles/ceph-mds/defaults/main.yml index 1bedb16e0..59689c171 100644 --- a/roles/ceph-mds/defaults/main.yml +++ b/roles/ceph-mds/defaults/main.yml @@ -7,6 +7,12 @@ fetch_directory: fetch/ +# Even though MDS nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on MDS nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +copy_admin_key: false + cephx: true diff --git a/roles/ceph-mds/tasks/pre_requisite.yml b/roles/ceph-mds/tasks/pre_requisite.yml index 9481bbb55..966e45872 100644 --- a/roles/ceph-mds/tasks/pre_requisite.yml +++ b/roles/ceph-mds/tasks/pre_requisite.yml @@ -9,11 +9,17 @@ - name: copy mds bootstrap key copy: - src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-mds/ceph.keyring" - dest: /var/lib/ceph/bootstrap-mds/ceph.keyring + src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" + dest: "{{ item }}" owner: "{{ key_owner }}" group: "{{ key_group }}" mode: "{{ key_mode }}" + with_items: + - { name: /var/lib/ceph/bootstrap-mds/ceph.keyring, copy: true } + - { name: /etc/ceph/client.admin.keyring, "{{ copy_admin_key }}" } + when: + cephx and + item.copy is true - name: create mds directory file: diff --git a/roles/ceph-osd/defaults/main.yml b/roles/ceph-osd/defaults/main.yml index 7fbcece14..a609e7c9c 100644 --- a/roles/ceph-osd/defaults/main.yml +++ b/roles/ceph-osd/defaults/main.yml @@ -8,6 +8,12 @@ fetch_directory: fetch/ +# Even though OSD nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on OSD nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +copy_admin_key: false + #################### # OSD CRUSH LOCATION #################### diff --git a/roles/ceph-osd/tasks/pre_requisite.yml b/roles/ceph-osd/tasks/pre_requisite.yml index cd0fd7424..12fe9a571 100644 --- a/roles/ceph-osd/tasks/pre_requisite.yml +++ b/roles/ceph-osd/tasks/pre_requisite.yml @@ -23,10 +23,14 @@ - name: copy osd bootstrap key copy: - src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-osd/ceph.keyring" - dest: /var/lib/ceph/bootstrap-osd/ceph.keyring + src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" + dest: "{{ item }}" owner: "{{ key_owner }}" group: "{{ key_group }}" mode: "{{ key_mode }}" + with_items: + - { name: /var/lib/ceph/bootstrap-osd/ceph.keyring, copy: true } + - { name: /etc/ceph/client.admin.keyring, "{{ copy_admin_key }}" } when: - cephx + cephx and + item.copy is true diff --git a/roles/ceph-rgw/defaults/main.yml b/roles/ceph-rgw/defaults/main.yml index cee4bf9b6..e5b8350f3 100644 --- a/roles/ceph-rgw/defaults/main.yml +++ b/roles/ceph-rgw/defaults/main.yml @@ -7,6 +7,12 @@ fetch_directory: fetch/ +# Even though RGW nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on RGW nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +copy_admin_key: false + ## Ceph options # cephx: true diff --git a/roles/ceph-rgw/tasks/pre_requisite.yml b/roles/ceph-rgw/tasks/pre_requisite.yml index 2e9dda9db..a546774f6 100644 --- a/roles/ceph-rgw/tasks/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/pre_requisite.yml @@ -12,12 +12,17 @@ - name: copy rados gateway bootstrap key copy: - src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-rgw/ceph.keyring" - dest: /var/lib/ceph/bootstrap-rgw/ceph.keyring + src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" + dest: "{{ item }}" owner: "{{ key_owner }}" group: "{{ key_group }}" mode: "{{ key_mode }}" - when: cephx + with_items: + - { name: /var/lib/ceph/bootstrap-rgw/ceph.keyring, copy: true } + - { name: /etc/ceph/client.admin.keyring, "{{ copy_admin_key }}" } + when: + cephx and + item.copy is true - name: create rados gateway keyring command: ceph --cluster ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }}/keyring From 51e4fe8e0ba406e064a92929519a93313db1f881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 25 Feb 2016 12:10:45 +0100 Subject: [PATCH 2/2] ceph-: update group_vars to reflect previous change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Han --- group_vars/mdss.sample | 5 +++++ group_vars/osds.sample | 6 ++++++ group_vars/rgws.sample | 6 ++++++ roles/ceph-mds/tasks/pre_requisite.yml | 8 ++++---- roles/ceph-osd/tasks/pre_requisite.yml | 8 ++++---- roles/ceph-rgw/tasks/pre_requisite.yml | 8 ++++---- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/group_vars/mdss.sample b/group_vars/mdss.sample index fae7bc279..5039b3b9f 100644 --- a/group_vars/mdss.sample +++ b/group_vars/mdss.sample @@ -10,6 +10,11 @@ dummy: #fetch_directory: fetch/ +# Even though MDS nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on MDS nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +# copy_admin_key: false ########## # DOCKER # diff --git a/group_vars/osds.sample b/group_vars/osds.sample index 1af7191e8..66904a7b1 100644 --- a/group_vars/osds.sample +++ b/group_vars/osds.sample @@ -11,6 +11,12 @@ dummy: #fetch_directory: fetch/ +# Even though OSD nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on OSD nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +#copy_admin_key: false + #################### # OSD CRUSH LOCATION #################### diff --git a/group_vars/rgws.sample b/group_vars/rgws.sample index 707c36116..8ec233ca8 100644 --- a/group_vars/rgws.sample +++ b/group_vars/rgws.sample @@ -9,6 +9,12 @@ dummy: # #cephx: true +# Even though RGW nodes should not have the admin key +# at their disposal, some people might want to have it +# distributed on RGW nodes. Setting 'copy_admin_key' to 'true' +# will copy the admin key to the /etc/ceph/ directory +# copy_admin_key: false + # Used for the sudo exception while starting the radosgw process # a new entry /etc/sudoers.d/ceph will be created # allowing root to not require tty diff --git a/roles/ceph-mds/tasks/pre_requisite.yml b/roles/ceph-mds/tasks/pre_requisite.yml index 966e45872..ede48415a 100644 --- a/roles/ceph-mds/tasks/pre_requisite.yml +++ b/roles/ceph-mds/tasks/pre_requisite.yml @@ -10,16 +10,16 @@ - name: copy mds bootstrap key copy: src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" - dest: "{{ item }}" + dest: "{{ item.name }}" owner: "{{ key_owner }}" group: "{{ key_group }}" mode: "{{ key_mode }}" with_items: - - { name: /var/lib/ceph/bootstrap-mds/ceph.keyring, copy: true } - - { name: /etc/ceph/client.admin.keyring, "{{ copy_admin_key }}" } + - { name: /var/lib/ceph/bootstrap-mds/ceph.keyring, copy_key: true } + - { name: /etc/ceph/ceph.client.admin.keyring, copy_key: "{{ copy_admin_key }}" } when: cephx and - item.copy is true + item.copy_key|bool - name: create mds directory file: diff --git a/roles/ceph-osd/tasks/pre_requisite.yml b/roles/ceph-osd/tasks/pre_requisite.yml index 12fe9a571..61b9395a8 100644 --- a/roles/ceph-osd/tasks/pre_requisite.yml +++ b/roles/ceph-osd/tasks/pre_requisite.yml @@ -24,13 +24,13 @@ - name: copy osd bootstrap key copy: src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" - dest: "{{ item }}" + dest: "{{ item.name }}" owner: "{{ key_owner }}" group: "{{ key_group }}" mode: "{{ key_mode }}" with_items: - - { name: /var/lib/ceph/bootstrap-osd/ceph.keyring, copy: true } - - { name: /etc/ceph/client.admin.keyring, "{{ copy_admin_key }}" } + - { name: /var/lib/ceph/bootstrap-osd/ceph.keyring, copy_key: true } + - { name: /etc/ceph/ceph.client.admin.keyring, copy_key: "{{ copy_admin_key }}" } when: cephx and - item.copy is true + item.copy_key|bool diff --git a/roles/ceph-rgw/tasks/pre_requisite.yml b/roles/ceph-rgw/tasks/pre_requisite.yml index a546774f6..8b24a271e 100644 --- a/roles/ceph-rgw/tasks/pre_requisite.yml +++ b/roles/ceph-rgw/tasks/pre_requisite.yml @@ -13,16 +13,16 @@ - name: copy rados gateway bootstrap key copy: src: "{{ fetch_directory }}/{{ fsid }}{{ item.name }}" - dest: "{{ item }}" + dest: "{{ item.name }}" owner: "{{ key_owner }}" group: "{{ key_group }}" mode: "{{ key_mode }}" with_items: - - { name: /var/lib/ceph/bootstrap-rgw/ceph.keyring, copy: true } - - { name: /etc/ceph/client.admin.keyring, "{{ copy_admin_key }}" } + - { name: /var/lib/ceph/bootstrap-rgw/ceph.keyring, copy_key: true } + - { name: /etc/ceph/ceph.client.admin.keyring, copy_key: "{{ copy_admin_key }}" } when: cephx and - item.copy is true + item.copy_key|bool - name: create rados gateway keyring command: ceph --cluster ceph --name client.bootstrap-rgw --keyring /var/lib/ceph/bootstrap-rgw/ceph.keyring auth get-or-create client.rgw.{{ ansible_hostname }} osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.{{ ansible_hostname }}/keyring