rbd-mirror: use the new rbd-mirror key

Instead of using the old rbd key let's use the new rbr-mirror key to
bootstrap the rbd -mirror daemon.

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/3320/head
Sébastien Han 2018-11-05 17:14:31 +01:00
parent 53910de43b
commit e552026418
6 changed files with 14 additions and 42 deletions

View File

@ -103,10 +103,6 @@
when:
- cephx
- name: set_fact bootstrap_rbd_keyring
set_fact:
bootstrap_rbd_keyring: "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring"
- name: copy keys to the ansible server
fetch:
src: "{{ item }}"
@ -117,7 +113,8 @@
- /var/lib/ceph/bootstrap-osd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- "{{ bootstrap_rbd_keyring | default([]) }}"
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
when:
- cephx
- inventory_hostname == groups[mon_group_name] | last

View File

@ -8,6 +8,7 @@
- /var/lib/ceph/bootstrap-rgw/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-mds/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
- name: stat for ceph config and keys
stat:

View File

@ -1,8 +1,8 @@
---
- name: copy rbd-mirror bootstrap key
copy:
src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring"
dest: "/var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring"
src: "{{ fetch_directory }}/{{ fsid }}/var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring"
dest: "/var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring"
owner: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
group: "{{ ceph_uid if containerized_deployment else 'ceph' }}"
mode: "{{ ceph_keyring_permissions }}"

View File

@ -1,33 +0,0 @@
---
- name: set_fact ceph_config_keys
set_fact:
ceph_config_keys:
- /etc/ceph/{{ cluster }}.client.admin.keyring
- /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring
- name: stat for ceph config and keys
stat:
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
delegate_to: localhost
with_items: "{{ ceph_config_keys }}"
changed_when: false
become: false
failed_when: false
check_mode: no
register: statconfig
when: item | length > 0
- name: try to fetch ceph config and keys
copy:
src: "{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
mode: 0644
changed_when: false
with_together:
- "{{ ceph_config_keys }}"
- "{{ statconfig.results }}"
when:
- not item.1.get('skipped')
- item.1.stat.exists == true

View File

@ -9,7 +9,14 @@
- package-install
- name: create rbd-mirror keyring
command: ceph --cluster {{ cluster }} --name client.bootstrap-rbd --keyring /var/lib/ceph/bootstrap-rbd/{{ cluster }}.keyring auth get-or-create client.rbd-mirror.{{ ansible_hostname }} mon 'profile rbd' osd 'profile rbd' -o /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring
command: >
ceph --cluster {{ cluster }}
--name client.bootstrap-rbd-mirror
--keyring /var/lib/ceph/bootstrap-rbd-mirror/{{ cluster }}.keyring
auth get-or-create client.rbd-mirror.{{ ansible_hostname }}
mon 'profile rbd-mirror'
osd 'profile rbd'
-o /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring
args:
creates: /etc/ceph/{{ cluster }}.client.rbd-mirror.{{ ansible_hostname }}.keyring
changed_when: false

View File

@ -37,7 +37,7 @@ class TestRbdMirrors(object):
docker_exec_cmd = ''
hostname = node["vars"]["inventory_hostname"]
cluster = node['cluster_name']
cmd = "sudo {docker_exec_cmd} ceph --name client.bootstrap-rbd --keyring /var/lib/ceph/bootstrap-rbd/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
cmd = "sudo {docker_exec_cmd} ceph --name client.bootstrap-rbd-mirror --keyring /var/lib/ceph/bootstrap-rbd-mirror/{cluster}.keyring --cluster={cluster} --connect-timeout 5 -f json -s".format(
docker_exec_cmd=docker_exec_cmd,
hostname=hostname,
cluster=cluster