From 47cfbaa9070f5a12272627ff3648e28388f279f5 Mon Sep 17 00:00:00 2001 From: grakiss Date: Mon, 21 Sep 2015 09:48:33 +0800 Subject: support ceph deploy for centos JIRA: COMPASS-60 Change-Id: I9bcc5009b7d9b2f3cc48f1f1a448a1f07af65494 Signed-off-by: grakiss --- .../ansible/roles/ceph-deploy/files/create_osd.sh | 6 +-- .../roles/ceph-deploy/tasks/ceph_install.yml | 49 ---------------------- .../ceph-deploy/tasks/ceph_install_Debian.yml | 49 ++++++++++++++++++++++ .../ceph-deploy/tasks/ceph_install_RedHat.yml | 49 ++++++++++++++++++++++ .../ansible/roles/ceph-deploy/tasks/main.yml | 10 ++++- .../ansible/roles/ceph-deploy/templates/ceph.repo | 7 ---- .../ansible/roles/ceph-deploy/vars/RedHat.yml | 14 +------ 7 files changed, 111 insertions(+), 73 deletions(-) delete mode 100644 deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install.yml create mode 100644 deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml create mode 100644 deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml delete mode 100644 deploy/adapters/ansible/roles/ceph-deploy/templates/ceph.repo (limited to 'deploy/adapters') diff --git a/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh b/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh index 2535f364..7a6cc1e2 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh +++ b/deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh @@ -19,15 +19,15 @@ fi if [ -L "/dev/ceph-volumes/ceph0" ]; then echo "remove lv vg" -lvremove /dev/ceph-volumes/ceph0 -vgremove ceph-volumes +lvremove -f /dev/ceph-volumes/ceph0 +vgremove -f ceph-volumes rm -r /dev/ceph-volumes fi losetup -d /dev/loop0 echo "vgcreate" -vgcreate ceph-volumes $(sudo losetup --show -f /ceph/images/ceph-volumes.img) +vgcreate -y ceph-volumes $(sudo losetup --show -f /ceph/images/ceph-volumes.img) echo "lvcreate" sudo lvcreate -L9G -nceph0 ceph-volumes echo "mkfs" diff --git a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install.yml deleted file mode 100644 index f897c944..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- name: create ceph cluster - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ ceph_cluster_hosts.stdout_lines[0] }} - tags: - - create_ceph_cluster - -- name: install ceph for every nodes includes jumpserver - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy install {{ 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: 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['controller'] }}" - tags: - - create_osd - -- name: create osd - shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" - with_items: - - "{{ groups['controller'] }}" - tags: - - create_osd - -- name: prepare create osd - shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd prepare {{ item }}:/var/local/osd - with_items: - - "{{ groups['controller'] }}" - 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['controller'] }}" - 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_Debian.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml new file mode 100644 index 00000000..f897c944 --- /dev/null +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml @@ -0,0 +1,49 @@ +--- +- name: create ceph cluster + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ ceph_cluster_hosts.stdout_lines[0] }} + tags: + - create_ceph_cluster + +- name: install ceph for every nodes includes jumpserver + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy install {{ 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: 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['controller'] }}" + tags: + - create_osd + +- name: create osd + shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" + with_items: + - "{{ groups['controller'] }}" + tags: + - create_osd + +- name: prepare create osd + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy osd prepare {{ item }}:/var/local/osd + with_items: + - "{{ groups['controller'] }}" + 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['controller'] }}" + 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 new file mode 100644 index 00000000..ed88cd5c --- /dev/null +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml @@ -0,0 +1,49 @@ +--- +- name: create ceph cluster + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy new {{ ceph_cluster_hosts.stdout_lines[0] }} + tags: + - create_ceph_cluster + +- 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: 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['controller'] }}" + tags: + - create_osd + +- name: create osd + shell: ssh -o StrictHostKeyChecking=no -t {{ item }} "~/create_osd.sh" + with_items: + - "{{ groups['controller'] }}" + tags: + - create_osd + +- name: prepare create osd + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --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 osd prepare {{ item }}:/var/local/osd + with_items: + - "{{ groups['controller'] }}" + tags: + - create_osd + + +- name: activate osd + shell: cd {{ ceph_cluster_dir[0] }} && ceph-deploy --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 osd activate {{ item }}:/var/local/osd + with_items: + - "{{ groups['controller'] }}" + 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/main.yml b/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml index a1a9127d..b50b38c8 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml @@ -6,8 +6,14 @@ - ceph_setup_env - ceph_install -- include: ceph_install.yml - when: inventory_hostname == "{{ groups['controller'][0] }}" +- include: ceph_install_Debian.yml + when: inventory_hostname == groups['controller'][0] and ansible_os_family == "Debian" + tags: + - ceph_deploy + - ceph_install + +- include: ceph_install_RedHat.yml + when: inventory_hostname == groups['controller'][0] and ansible_os_family == "RedHat" tags: - ceph_deploy - ceph_install diff --git a/deploy/adapters/ansible/roles/ceph-deploy/templates/ceph.repo b/deploy/adapters/ansible/roles/ceph-deploy/templates/ceph.repo deleted file mode 100644 index e6b7c7d9..00000000 --- a/deploy/adapters/ansible/roles/ceph-deploy/templates/ceph.repo +++ /dev/null @@ -1,7 +0,0 @@ -[ceph-noarch] -name=Ceph noarch packages -baseurl=http://ceph.com/rpm-giant/el6/noarch -enabled=1 -gpgcheck=1 -type=rpm-md -gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc diff --git a/deploy/adapters/ansible/roles/ceph-deploy/vars/RedHat.yml b/deploy/adapters/ansible/roles/ceph-deploy/vars/RedHat.yml index 5ed6cc10..fd607d38 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/vars/RedHat.yml @@ -1,18 +1,8 @@ --- packages: + - ceph-radosgw + - fcgi - ceph-deploy - - python-flask - - libgoogle-perftools4 - - libleveldb1 - - liblttng-ust0 - - libsnappy1 - - librbd1 - - librados2 - - python-ceph - ceph - - ceph-mds - - ceph-common - - ceph-fs-common - - gdisk services: [] -- cgit 1.2.3-korg