diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-08-03 15:29:36 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-08-03 15:29:36 +0000 |
| commit | 63d448fe2e110d1ef908645cedbb2431f5ffe216 (patch) | |
| tree | 11044517fcc92e5999b3ba9ce642bedfdc688731 /ansible | |
| parent | ec4e8092d9b06fdf44543addc0751b8b76599495 (diff) | |
| parent | ffafebf87c56d66363317a5495ccc3c7ae64fdcd (diff) | |
| download | kolla-63d448fe2e110d1ef908645cedbb2431f5ffe216.tar.gz kolla-63d448fe2e110d1ef908645cedbb2431f5ffe216.zip | |
Merge "External Ceph - Implementation Nova"
Diffstat (limited to 'ansible')
| -rw-r--r-- | ansible/group_vars/all.yml | 7 | ||||
| -rw-r--r-- | ansible/roles/nova/tasks/deploy.yml | 7 | ||||
| -rw-r--r-- | ansible/roles/nova/tasks/external-ceph.yml | 49 | ||||
| -rw-r--r-- | ansible/roles/nova/templates/nova-compute.json.j2 | 14 | ||||
| -rw-r--r-- | ansible/roles/nova/templates/nova-libvirt.json.j2 | 2 | ||||
| -rw-r--r-- | ansible/roles/nova/templates/nova.conf.j2 | 8 |
6 files changed, 73 insertions, 14 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index e5ff91e3b..3b5a1ae3c 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -282,6 +282,13 @@ cinder_volume_backend_name: "{{ 'cinder-volumes' if cinder_backend_iscsi | bool cinder_iscsi_helper: "{{ 'tgtadm' if cinder_backend_iscsi | bool else '' }}" cinder_iscsi_protocol: "{{ 'iscsi' if cinder_backend_iscsi | bool else '' }}" + +####################### +# Nova options +####################### +nova_backend_ceph: "{{ enable_ceph }}" +nova_backend: "{{ 'rbd' if nova_backend_ceph | bool else 'default' }}" + ################### # Ceph options ################### diff --git a/ansible/roles/nova/tasks/deploy.yml b/ansible/roles/nova/tasks/deploy.yml index 13a5dba8f..21efc2b2e 100644 --- a/ansible/roles/nova/tasks/deploy.yml +++ b/ansible/roles/nova/tasks/deploy.yml @@ -1,7 +1,7 @@ --- - include: ceph.yml when: - - enable_ceph | bool + - enable_ceph | bool and nova_backend == "rbd" - inventory_hostname in groups['ceph-mon'] or inventory_hostname in groups['compute'] or inventory_hostname in groups['nova-api'] or @@ -10,6 +10,11 @@ inventory_hostname in groups['nova-novncproxy'] or inventory_hostname in groups['nova-scheduler'] +- include: external-ceph.yml + when: + - enable_ceph | bool == False and nova_backend == "rbd" + - inventory_hostname in groups['compute'] + - include: register.yml when: inventory_hostname in groups['nova-api'] diff --git a/ansible/roles/nova/tasks/external-ceph.yml b/ansible/roles/nova/tasks/external-ceph.yml new file mode 100644 index 000000000..8743e7702 --- /dev/null +++ b/ansible/roles/nova/tasks/external-ceph.yml @@ -0,0 +1,49 @@ +--- +- name: Ensuring config directory exists + file: + path: "{{ node_config_directory }}/{{ item }}" + state: "directory" + with_items: + - "nova-compute" + - "nova-libvirt/secrets" + when: inventory_hostname in groups['compute'] + +- name: Find keyring files + local_action: find paths="{{ node_custom_config }}/nova/" patterns="^ceph\.client\..*?\.keyring$" use_regex=True + register: cephx_keyring_files + +- name: Copy over ceph keyring file + copy: + src: "{{ cephx_keyring_files.files[0].path }}" + dest: "{{ node_config_directory }}/{{item}}/" + with_items: + - nova-compute + - nova-libvirt + when: inventory_hostname in groups['compute'] + +- name: Copy over ceph.conf + copy: + src: "{{ node_custom_config }}/nova/ceph.conf" + dest: "{{ node_config_directory }}/{{ item }}/" + with_items: + - nova-compute + - nova-libvirt + when: inventory_hostname in groups['compute'] + +- name: Pushing secrets xml for libvirt + template: + src: "secret.xml.j2" + dest: "{{ node_config_directory }}/nova-libvirt/secrets/{{ rbd_secret_uuid }}.xml" + mode: "0600" + when: inventory_hostname in groups['compute'] + +- name: Extract key from file + local_action: shell cat {{ cephx_keyring_files.files[0].path }} | grep -E 'key\s*=' | awk '{ print $3 }' + register: cephx_raw_key + +- name: Pushing secrets key for libvirt + copy: + content: "{{ cephx_raw_key.stdout }}" + dest: "{{ node_config_directory }}/nova-libvirt/secrets/{{ rbd_secret_uuid }}.base64" + mode: "0600" + when: inventory_hostname in groups['compute'] diff --git a/ansible/roles/nova/templates/nova-compute.json.j2 b/ansible/roles/nova/templates/nova-compute.json.j2 index f3a45f754..a3fd495de 100644 --- a/ansible/roles/nova/templates/nova-compute.json.j2 +++ b/ansible/roles/nova/templates/nova-compute.json.j2 @@ -6,18 +6,12 @@ "dest": "/etc/nova/nova.conf", "owner": "nova", "perm": "0600" - }{% if enable_ceph | bool %}, + }{% if nova_backend == "rbd" %}, { - "source": "{{ container_config_directory }}/ceph.client.nova.keyring", - "dest": "/etc/ceph/ceph.client.nova.keyring", + "source": "{{ container_config_directory }}/ceph.*", + "dest": "/etc/ceph/", "owner": "nova", - "perm": "0600" - }, - { - "source": "{{ container_config_directory }}/ceph.conf", - "dest": "/etc/ceph/ceph.conf", - "owner": "nova", - "perm": "0600" + "perm": "0700" }{% endif %} ] } diff --git a/ansible/roles/nova/templates/nova-libvirt.json.j2 b/ansible/roles/nova/templates/nova-libvirt.json.j2 index dca7056b2..aa19f7a39 100644 --- a/ansible/roles/nova/templates/nova-libvirt.json.j2 +++ b/ansible/roles/nova/templates/nova-libvirt.json.j2 @@ -12,7 +12,7 @@ "dest": "/etc/libvirt/qemu.conf", "owner": "root", "perm": "0644" - }{% if enable_ceph | bool %}, + }{% if nova_backend == "rbd" %}, { "source": "{{ container_config_directory }}/secrets", "dest": "/etc/libvirt/secrets", diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index f1dd54955..792f8d0b5 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -161,15 +161,19 @@ memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansi [libvirt] connection_uri = "qemu+tcp://{{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}/system" -{% if enable_ceph | bool %} +{% if enable_ceph | bool and nova_backend == "rbd" %} images_type = rbd images_rbd_pool = {{ ceph_nova_pool_name }} images_rbd_ceph_conf = /etc/ceph/ceph.conf rbd_user = nova -rbd_secret_uuid = {{ rbd_secret_uuid }} disk_cachemodes="network=writeback" hw_disk_discard = unmap {% endif %} +{% if nova_backend == "rbd" %} +rbd_secret_uuid = {{ rbd_secret_uuid }} +{% endif %} + + [upgrade_levels] compute = auto |
