diff options
Diffstat (limited to 'deploy/adapters/ansible/roles/ceph-deploy/tasks')
6 files changed, 0 insertions, 411 deletions
diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml deleted file mode 100644 index 39a5cf8f..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml +++ /dev/null @@ -1,74 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: create ceph cluster - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ mon_nodes.stdout_lines[0] }} - tags: - - create_ceph_cluster - -- name: default config for ceph - ini_file: - dest: "{{ ceph_cluster_dir[0] }}/ceph.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: - - { section: "global", option: "osd_journal_size", value: "1024" } - - { section: "global", option: "osd_pool_default_size", value: "2" } - - { section: "global", option: "public_network", value: "{{ mgmt_cidr }}" } - - { section: "global", option: "cluster_network", value: "{{ storage_cidr }}" } - -- name: install ceph for every nodes includes jumpserver - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy install {{ ceph_cluster_hosts.stdout_lines[0]}} - ignore_errors: true - -- name: create monitor node in controller group - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --overwrite-conf mon create-initial - -- name: gather keys - shell: sleep 5 && cd {{ ceph_cluster_dir[0] }} && ceph-deploy gatherkeys {{ inventory_hostname }} - ignore_errors: True - -- name: copy create_osd.sh to host1 - copy: src=create_osd.sh dest=~/create_osd.sh mode=0777 - tags: - - create_osd - -- name: copy create_osd.sh to other nodes - shell: scp -o StrictHostKeyChecking=no ~/create_osd.sh {{ item }}:~/ - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - -- name: create osd - shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - -- name: prepare create osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd prepare {{ item }}:/var/local/osd - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - - -- name: activate osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd activate {{ item }}:/var/local/osd && ceph-deploy osd activate {{ item }}:/var/local/osd - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - - activate_osd - -- name: create admin node - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy admin {{ ceph_cluster_hosts.stdout_lines[0] }} diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml deleted file mode 100644 index f648a9ea..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml +++ /dev/null @@ -1,73 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: create ceph cluster - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ mon_nodes.stdout_lines[0] }} - tags: - - create_ceph_cluster - -- name: default config for ceph - ini_file: - dest: "{{ ceph_cluster_dir[0] }}/ceph.conf" - section: "{{ item.section }}" - option: "{{ item.option }}" - value: "{{ item.value }}" - with_items: - - { section: "global", option: "osd_journal_size", value: "1024" } - - { section: "global", option: "osd_pool_default_size", value: "2" } - - { section: "global", option: "public_network", value: "{{ mgmt_cidr }}" } - - { section: "global", option: "cluster_network", value: "{{ storage_cidr }}" } - -- name: install ceph for every nodes includes jumpserver - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy install --no-adjust-repos --repo-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa --gpg-url http://10.1.0.12/cblr/repo_mirror/centos7-juno-ppa/ceph_key_release.asc {{ ceph_cluster_hosts.stdout_lines[0]}} - -- name: create monitor node in controller group - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --overwrite-conf mon create-initial - -- name: gather keys - shell: sleep 5 && cd {{ ceph_cluster_dir[0] }} && ceph-deploy gatherkeys {{ inventory_hostname }} - ignore_errors: True - -- name: copy create_osd.sh to host1 - copy: src=create_osd.sh dest=~/create_osd.sh mode=0777 - tags: - - create_osd - -- name: copy create_osd.sh to other nodes - shell: scp -o StrictHostKeyChecking=no ~/create_osd.sh {{ item }}:~/ - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - -- name: create osd - shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - -- name: prepare create osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd prepare {{ item }}:/var/local/osd - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - - -- name: activate osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd activate {{ item }}:/var/local/osd - with_items: - - "{{ groups['ceph_osd'] }}" - tags: - - create_osd - - activate_osd - -- name: create admin node - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy admin {{ ceph_cluster_hosts.stdout_lines[0] }} diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml deleted file mode 100644 index 2ff9b788..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_conf.yml +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: chown of glance/api.log - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "chown -R glance:glance /var/log/glance" - with_items: - - "{{ groups['controller'] }}" - tags: - - ceph_conf_glance - ignore_errors: True - -- name: modify glance-api.conf for ceph - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(default_store\).*/\1 = rbd/g' /etc/glance/glance-api.conf && sed -i '/^\[glance_store/a stores = rbd\nrbd_store_pool = images\nrbd_store_user = glance\nrbd_store_ceph_conf = /etc/ceph/ceph.conf\nrbd_store_chunk_size = 8\nshow_image_direct_url=True' /etc/glance/glance-api.conf" - with_items: - - "{{ groups['controller'] }}" - tags: - - ceph_conf_glance - -- name: restart glance - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "rm -f /var/log/glance/api.log && chown -R glance:glance /var/log/glance && service {{ glance_service }} restart" - with_items: - - "{{ groups['controller'] }}" - tags: - - ceph_conf_glance - ignore_errors: True - -- name: modify cinder.conf for ceph - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(volume_driver\).*/\1 = cinder.volume.drivers.rbd.RBDDriver/g' /etc/cinder/cinder.conf && sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid.stdout_lines[0] }}/g' /etc/cinder/cinder.conf && sed -i '/^\[DEFAULT/a rbd_pool = volumes\nrbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_flatten_volume_from_snapshot = false\nrbd_max_clone_depth = 5\nrbd_store_chunk_size = 4\nrados_connect_timeout = -1\nglance_api_version = 2\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid.stdout_lines[0] }}' /etc/cinder/cinder.conf && service {{ cinder_service }} restart" - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_conf_cinder - -- name: modify nova.conf for ceph - shell: ssh -o StrictHostKeyChecking=no {{ item }} -t "sed -i 's/^\(images_type\).*/\1 = rbd/g' /etc/nova/nova-compute.conf && sed -i 's/^\(rbd_secret_uuid\).*/\1 = {{ ceph_uuid.stdout_lines[0] }}/g' /etc/nova/nova-compute.conf && sed -i '/^\[libvirt/a images_rbd_pool = vms\nimages_rbd_ceph_conf = /etc/ceph/ceph.conf\nrbd_user = cinder\nrbd_secret_uuid = {{ ceph_uuid.stdout_lines[0] }}\ndisk_cachemodes=\"network=writeback\"\nlive_migration_flag=\"VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST,VIR_MIGRATE_TUNNELLED\"' /etc/nova/nova-compute.conf && service {{ nova_service }} restart" - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_conf_nova diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_pre.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_pre.yml deleted file mode 100644 index 8770525e..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_openstack_pre.yml +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- - -- name: create pool - shell: ceph osd pool create {{ item }} 50 - with_items: - - volumes - - images - - backups - - vms - -- name: create ceph users for openstack - shell: 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' && ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images' - -- name: send glance key to controller nodes - shell: ceph auth get-or-create client.glance | ssh {{ item }} tee /etc/ceph/ceph.client.glance.keyring && ssh {{ item }} chown glance:glance /etc/ceph/ceph.client.glance.keyring - with_items: - - "{{ groups['controller'] }}" - -- name: send cinder key to compute nodes - shell: ceph auth get-or-create client.cinder | ssh {{ item }} tee /etc/ceph/ceph.client.cinder.keyring && ssh {{ item }} chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_send_key - -- name: copy cinder key to compute node - shell: ceph auth get-key client.cinder | ssh {{ item }} tee client.cinder.key - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_copy_secret - -- name: gen ceph uuid - shell: uuidgen - register: ceph_uuid - tags: - - ceph_copy_secret - -- name: gen template secret.xml - template: src=secret.j2 dest=~/secret.xml mode=0777 - tags: - - ceph_copy_secret - -- name: copy secret.xml to compute nodes - shell: scp -o StrictHostKeyChecking=no ~/secret.xml {{ item }}:~/secret.xml - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_copy_secret - -- name: undefine libvirt secret in case of repeatedly execute ceph_deploy - shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "virsh secret-list | awk '\$1 ~ /[0-9]+/ {print \$1}' | xargs virsh secret-undefine" - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_copy_secret - ignore_errors: True - - -- name: create key for libvirt on compute nodes - shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "virsh secret-define --file secret.xml && virsh secret-set-value --secret {{ ceph_uuid.stdout_lines[0] }} --base64 \$(cat client.cinder.key)" - with_items: - - "{{ groups['compute'] }}" - tags: - - ceph_copy_secret - ignore_errors: True - - diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml deleted file mode 100644 index 7b3099e2..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_setup_env.yml +++ /dev/null @@ -1,103 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- include_vars: "{{ ansible_os_family }}.yml" - -- name: copy rsa secret key from compass-core to host1 - copy: src=/root/.ssh/id_rsa dest=/root/.ssh/id_rsa mode=0600 - -- name: copy rsa pub key from compass-core to host1 - copy: src=/root/.ssh/id_rsa.pub dest=/root/.ssh/id_rsa.pub mode=0644 - -- name: gen ssh key for no-ask access to every nodes - shell: if [ ! -f ~/.ssh/id_rsa.pub ]; then ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N ""; else echo "already gen ssh key!"; fi; - -- name: copy key to node - shell: ssh-copy-id -i ~/.ssh/id_rsa.pub -o StrictHostKeyChecking=no root@{{ item }} - with_items: - - "{{ groups['all'] }}" - -- name: install ceph-related packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: packages | union(packages_noarch) - -- name: clear cluster_hosts_name - file: path=cluster_hosts_name state=absent - tags: - - create_ceph_cluster - - ceph_install - -- name: clear cluster_controller_nodes - file: path=cluster_controller_nodes state=absent - tags: - - create_ceph_cluster - - ceph_install - -- name: clear ceph_mon_nodes - file: path=ceph_mon_nodes state=absent - tags: - - create_ceph_cluster - - ceph_install - -- name: echo hosts name to file - shell: echo -n "{{ item }} " >> cluster_hosts_name - with_items: - - "{{ groups['all'] }}" - tags: - - create_ceph_cluster - - ceph_install - -- name: register hosts name - shell: cat cluster_hosts_name - register: ceph_cluster_hosts - tags: - - create_ceph_cluster - - echo_hosts - - ceph_install - -- name: echo controller name to file - shell: echo -n "{{ item }} " >> cluster_controller_nodes - with_items: - - "{{ groups['controller'] }}" - tags: - - create_ceph_cluster - - ceph_install - -- name: register controller nodes - shell: cat cluster_controller_nodes - register: controller_nodes - tags: - - create_ceph_cluster - - echo_hosts - - ceph_install - -- name: echo ceph-mon name to file - shell: echo -n "{{ item }} " >> ceph_mon_nodes - with_items: - - "{{ groups['ceph_mon'] }}" - tags: - - create_ceph_cluster - - ceph_install - -- name: register ceph-mon nodes - shell: cat ceph_mon_nodes - register: mon_nodes - tags: - - create_ceph_cluster - - echo_hosts - - ceph_install - -- name: gen clean ceph script - template: src=clean_ceph.j2 dest=~/clean_ceph.sh mode=0777 - -- name: clean ceph data of last deploy - shell: ~/clean_ceph.sh - -- name: mkdir for ceph-cluster - file: path={{ ceph_cluster_dir[0] }} state=directory mode=0755 diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml deleted file mode 100644 index 8b90a1b6..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- include: ceph_setup_env.yml - tags: - - ceph_deploy - - ceph_setup_env - - ceph_install - -- include: ceph_install_Debian.yml - when: ansible_os_family == "Debian" - tags: - - ceph_deploy - - ceph_install - -- include: ceph_install_RedHat.yml - when: ansible_os_family == "RedHat" - tags: - - ceph_deploy - - ceph_install - -- include: ceph_openstack_pre.yml - tags: - - ceph_deploy - - ceph_openstack_pre - - ceph_openstack - -- include: ceph_openstack_conf.yml - tags: - - ceph_deploy - - ceph_openstack_conf - - ceph_openstack - -- meta: flush_handlers |