From 5223965b6193757a5d63c7f5ccd466ce7953f6d7 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Tue, 29 Sep 2015 08:38:40 +0000 Subject: [PATCH] Fix ceph after config-external removal Change-Id: I46dc2f02dda8219878eee3755b0891f4c3450682 Partially-Implements: blueprint replace-config-external --- ansible/roles/ceph/tasks/bootstrap_osds.yml | 2 +- ansible/roles/ceph/tasks/generate_cluster.yml | 2 +- ansible/roles/ceph/tasks/start_mons.yml | 2 +- ansible/roles/ceph/tasks/start_osds.yml | 2 +- ansible/roles/ceph/templates/ceph-mon.json.j2 | 16 ++++++++-------- ansible/roles/ceph/templates/ceph-osd.json.j2 | 2 +- ansible/roles/cinder/tasks/ceph.yml | 8 ++++---- ansible/roles/glance/tasks/ceph.yml | 4 ++-- ansible/roles/nova/tasks/ceph.yml | 6 +++--- docker/base/set_configs.py | 8 +++++--- 10 files changed, 27 insertions(+), 25 deletions(-) diff --git a/ansible/roles/ceph/tasks/bootstrap_osds.yml b/ansible/roles/ceph/tasks/bootstrap_osds.yml index 59163f8d39..1909db27f5 100644 --- a/ansible/roles/ceph/tasks/bootstrap_osds.yml +++ b/ansible/roles/ceph/tasks/bootstrap_osds.yml @@ -20,7 +20,7 @@ name: "bootstrap_osd_{{ item.0 }}" image: "{{ ceph_osd_image_full }}" volumes: - - "{{ node_config_directory }}/ceph-osd/:/opt/kolla/ceph-osd/:ro" + - "{{ node_config_directory }}/ceph-osd/:/opt/kolla/config_files/:ro" - "/dev/:/dev/" env: KOLLA_BOOTSTRAP: diff --git a/ansible/roles/ceph/tasks/generate_cluster.yml b/ansible/roles/ceph/tasks/generate_cluster.yml index 1a0f16b1b8..5e4e7c560b 100644 --- a/ansible/roles/ceph/tasks/generate_cluster.yml +++ b/ansible/roles/ceph/tasks/generate_cluster.yml @@ -13,7 +13,7 @@ insecure_registry: "{{ docker_insecure_registry }}" name: ceph_mon image: "{{ ceph_mon_image_full }}" - volumes: "{{ node_config_directory }}/ceph-mon/:/opt/kolla/ceph-mon/:ro" + volumes: "{{ node_config_directory }}/ceph-mon/:/opt/kolla/config_files/:ro" volumes_from: - "ceph_mon_data" env: diff --git a/ansible/roles/ceph/tasks/start_mons.yml b/ansible/roles/ceph/tasks/start_mons.yml index 0f70905b87..f8f06d84ed 100644 --- a/ansible/roles/ceph/tasks/start_mons.yml +++ b/ansible/roles/ceph/tasks/start_mons.yml @@ -13,7 +13,7 @@ insecure_registry: "{{ docker_insecure_registry }}" name: ceph_mon image: "{{ ceph_mon_image_full }}" - volumes: "{{ node_config_directory }}/ceph-mon/:/opt/kolla/ceph-mon/:ro" + volumes: "{{ node_config_directory }}/ceph-mon/:/opt/kolla/config_files/:ro" volumes_from: - "ceph_mon_data" env: diff --git a/ansible/roles/ceph/tasks/start_osds.yml b/ansible/roles/ceph/tasks/start_osds.yml index 593ec7b15b..f10c575260 100644 --- a/ansible/roles/ceph/tasks/start_osds.yml +++ b/ansible/roles/ceph/tasks/start_osds.yml @@ -37,7 +37,7 @@ image: "{{ ceph_osd_image_full }}" volumes: - "/var/lib/ceph/osd/{{ item.1.fs_uuid }}:/var/lib/ceph/osd/ceph-{{ item.0.stdout }}" - - "{{ node_config_directory }}/ceph-osd/:/opt/kolla/ceph-osd/:ro" + - "{{ node_config_directory }}/ceph-osd/:/opt/kolla/config_files/:ro" - "/dev/:/dev/" env: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" diff --git a/ansible/roles/ceph/templates/ceph-mon.json.j2 b/ansible/roles/ceph/templates/ceph-mon.json.j2 index 0b6f2c7722..0580261f90 100644 --- a/ansible/roles/ceph/templates/ceph-mon.json.j2 +++ b/ansible/roles/ceph/templates/ceph-mon.json.j2 @@ -4,29 +4,29 @@ { "source": "/opt/kolla/config_files/ceph.conf", "dest": "/etc/ceph/ceph.conf", - "owner": "glance", + "owner": "ceph", "perm": "0600" - } + }, { "source": "/opt/kolla/config_files/ceph.client.admin.keyring", "dest": "/etc/ceph/ceph.client.admin.keyring", "owner": "ceph", - "perm": "0600" - "optional": True + "perm": "0600", + "optional": "True" }, { "source": "/opt/kolla/config_files/ceph.client.mon.keyring", "dest": "/etc/ceph/ceph.client.mon.keyring", "owner": "ceph", - "perm": "0600" - "optional": True + "perm": "0600", + "optional": "True" }, { "source": "/opt/kolla/config_files/ceph.monmap", "dest": "/etc/ceph/ceph.monmap", "owner": "ceph", - "perm": "0600" - "optional": True + "perm": "0600", + "optional": "True" } ] } diff --git a/ansible/roles/ceph/templates/ceph-osd.json.j2 b/ansible/roles/ceph/templates/ceph-osd.json.j2 index 288ebc6ba7..831d8085fe 100644 --- a/ansible/roles/ceph/templates/ceph-osd.json.j2 +++ b/ansible/roles/ceph/templates/ceph-osd.json.j2 @@ -4,7 +4,7 @@ { "source": "/opt/kolla/config_files/ceph.conf", "dest": "/etc/ceph/ceph.conf", - "owner": "glance", + "owner": "ceph", "perm": "0600" }, { diff --git a/ansible/roles/cinder/tasks/ceph.yml b/ansible/roles/cinder/tasks/ceph.yml index ac7fc75fb9..9275318837 100644 --- a/ansible/roles/cinder/tasks/ceph.yml +++ b/ansible/roles/cinder/tasks/ceph.yml @@ -19,7 +19,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for cinder - command: docker exec -it ceph_mon ceph osd pool create volumes 128 + command: docker exec ceph_mon ceph osd pool create volumes 128 delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -27,7 +27,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for cinder-backup - command: docker exec -it ceph_mon ceph osd pool create backups 128 + command: docker exec ceph_mon ceph osd pool create backups 128 delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -35,7 +35,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for cinder - command: docker exec -it ceph_mon ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' + command: docker exec ceph_mon ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' register: cephx_key_cinder delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False @@ -43,7 +43,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for cinder-backup - command: docker exec -it ceph_mon ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups' + command: docker exec ceph_mon ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups' register: cephx_key_cinder_backup delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False diff --git a/ansible/roles/glance/tasks/ceph.yml b/ansible/roles/glance/tasks/ceph.yml index 904bd3340d..b1270eb8ee 100644 --- a/ansible/roles/glance/tasks/ceph.yml +++ b/ansible/roles/glance/tasks/ceph.yml @@ -13,7 +13,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for glance - command: docker exec -it ceph_mon ceph osd pool create images 128 + command: docker exec ceph_mon ceph osd pool create images 128 delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -21,7 +21,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring - command: docker exec -it ceph_mon ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images' + command: docker exec ceph_mon ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images' register: cephx_key delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False diff --git a/ansible/roles/nova/tasks/ceph.yml b/ansible/roles/nova/tasks/ceph.yml index 4ab79ae34f..b7dffcc576 100644 --- a/ansible/roles/nova/tasks/ceph.yml +++ b/ansible/roles/nova/tasks/ceph.yml @@ -19,7 +19,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Creating ceph pool for vms - command: docker exec -it ceph_mon ceph osd pool create vms 128 + command: docker exec ceph_mon ceph osd pool create vms 128 delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False failed_when: False @@ -27,7 +27,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for nova - command: docker exec -it ceph_mon ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' + command: docker exec ceph_mon ceph auth get-or-create client.nova mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images' register: cephx_key delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False @@ -35,7 +35,7 @@ # TODO(SamYaple): Improve failed_when and changed_when tests - name: Pulling cephx keyring for libvirt - command: docker exec -it ceph_mon ceph auth get-key client.nova + command: docker exec ceph_mon ceph auth get-key client.nova register: cephx_raw_key delegate_to: "{{ groups['ceph-mon'][0] }}" changed_when: False diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 19415c6fcc..941e74ca23 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -86,11 +86,13 @@ def copy_files(data): else: # Source is a directory for src in os.listdir(source_path): - LOG.info('Copying {} to {}'.format(src, dest_path)) + LOG.info('Copying {} to {}'.format( + os.path.join(source_path, src), dest_path)) + if os.path.isdir(src): - shutil.copytree(src, dest_path) + shutil.copytree(os.path.join(source_path, src), dest_path) else: - shutil.copy(src, dest_path) + shutil.copy(os.path.join(source_path, src), dest_path) def set_permissions(data):