diff options
author | grakiss <grakiss.wanglei@huawei.com> | 2015-09-21 09:48:33 +0800 |
---|---|---|
committer | grakiss <grakiss.wanglei@huawei.com> | 2015-09-24 15:43:56 +0800 |
commit | 47cfbaa9070f5a12272627ff3648e28388f279f5 (patch) | |
tree | 407b03c64a1255f57f1c3eb18043ce3d63201236 | |
parent | d16d74fbbe738f0d15366dedf9f5e042505ee1e8 (diff) |
support ceph deploy for centos
JIRA: COMPASS-60
Change-Id: I9bcc5009b7d9b2f3cc48f1f1a448a1f07af65494
Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
-rwxr-xr-x | build/make_repo.sh | 8 | ||||
-rw-r--r-- | build/os/centos/ceph_key_release.asc | 29 | ||||
-rw-r--r-- | build/os/centos/rhel7/juno/Dockerfile.tmpl | 1 | ||||
-rw-r--r-- | build/templates/RedHat_juno.tmpl | 29 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ceph-deploy/files/create_osd.sh | 6 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml (renamed from deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install.yml) | 0 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_RedHat.yml | 49 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ceph-deploy/tasks/main.yml | 10 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ceph-deploy/templates/ceph.repo | 7 | ||||
-rw-r--r-- | deploy/adapters/ansible/roles/ceph-deploy/vars/RedHat.yml | 14 |
10 files changed, 128 insertions, 25 deletions
diff --git a/build/make_repo.sh b/build/make_repo.sh index 9a56cdf9..c58a032c 100755 --- a/build/make_repo.sh +++ b/build/make_repo.sh @@ -20,7 +20,7 @@ function process_env() cat <<EOF >${WORK_PATH}/work/repo/cp_repo.sh #!/bin/bash set -ex -cp /*.tar.gz /result +cp /*.tar.gz /result -f EOF sudo apt-get install python-yaml -y @@ -130,6 +130,7 @@ function make_repo() # copy centos comps.xml to work dir if [[ $arch == RedHat && -f ${WORK_PATH}/build/os/$os_name/comps.xml ]]; then cp -rf ${WORK_PATH}/build/os/$os_name/comps.xml ${WORK_PATH}/work/repo + cp -rf ${WORK_PATH}/build/os/$os_name/ceph_key_release.asc ${WORK_PATH}/work/repo fi sudo docker build -t ${docker_tag} -f ${WORK_PATH}/work/repo/${dockerfile} ${WORK_PATH}/work/repo/ @@ -185,6 +186,11 @@ function main() if [[ $# -eq 0 ]]; then make_all_repo + elif [ "$1" = "rhel7" ]; then + echo "make rhel7" + make_repo --os-ver rhel7 --package-tag juno \ + --ansible-dir $WORK_PATH/deploy/adapters/ansible \ + --default-package "rsyslog-7.6.7-1.el7 strace net-tools wget vim openssh-server dracut-config-rescue-033-241.el7_1.3 dracut-network-033-241.el7_1.3" else make_repo $* fi diff --git a/build/os/centos/ceph_key_release.asc b/build/os/centos/ceph_key_release.asc new file mode 100644 index 00000000..d2961c52 --- /dev/null +++ b/build/os/centos/ceph_key_release.asc @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQINBFX4hgkBEADLqn6O+UFp+ZuwccNldwvh5PzEwKUPlXKPLjQfXlQRig1flpCH +E0HJ5wgGlCtYd3Ol9f9+qU24kDNzfbs5bud58BeE7zFaZ4s0JMOMuVm7p8JhsvkU +C/Lo/7NFh25e4kgJpjvnwua7c2YrA44ggRb1QT19ueOZLK5wCQ1mR+0GdrcHRCLr +7Sdw1d7aLxMT+5nvqfzsmbDullsWOD6RnMdcqhOxZZvpay8OeuK+yb8FVQ4sOIzB +FiNi5cNOFFHg+8dZQoDrK3BpwNxYdGHsYIwU9u6DWWqXybBnB9jd2pve9PlzQUbO +eHEa4Z+jPqxY829f4ldaql7ig8e6BaInTfs2wPnHJ+606g2UH86QUmrVAjVzlLCm +nqoGymoAPGA4ObHu9X3kO8viMBId9FzooVqR8a9En7ZE0Dm9O7puzXR7A1f5sHoz +JdYHnr32I+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/kIiXG2SxPUTjjEGOVgeA +=/Tod +-----END PGP PUBLIC KEY BLOCK----- diff --git a/build/os/centos/rhel7/juno/Dockerfile.tmpl b/build/os/centos/rhel7/juno/Dockerfile.tmpl index d0d45ae4..450e5c85 100644 --- a/build/os/centos/rhel7/juno/Dockerfile.tmpl +++ b/build/os/centos/rhel7/juno/Dockerfile.tmpl @@ -17,6 +17,7 @@ RUN chmod +x /tmp/chigang/$script RUN /tmp/chigang/$script #end for ADD ./comps.xml / +ADD ./ceph_key_release.asc / ADD ./install_packages.sh /tmp/chigang/install_packages.sh RUN chmod +x /tmp/chigang/install_packages.sh RUN /tmp/chigang/install_packages.sh diff --git a/build/templates/RedHat_juno.tmpl b/build/templates/RedHat_juno.tmpl index 9741b860..91be6151 100644 --- a/build/templates/RedHat_juno.tmpl +++ b/build/templates/RedHat_juno.tmpl @@ -1,10 +1,13 @@ #!/bin/bash set -x +yum remove systemd -y # add 163 repo yum install wget -y wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo +wget -O /epel-release-7-5.noarch.rpm http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm yum remove wget iptables-services -y +yum update -y rm -f /etc/yum.repos.d/CentOS-*.repo yum repolist yum clean all @@ -35,6 +38,26 @@ gpgkey=http://rpms.adiscon.com/RPM-GPG-KEY-Adiscon protect=1 EOF +cat <<EOF >/etc/yum.repos.d/ceph.repo +[ceph] +name=Ceph packages for x86_64 +baseurl=http://ceph.com/rpm-hammer/rhel7/x86_64 +enabled=1 +priority=2 +gpgcheck=1 +type=rpm-md +gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc + +[ceph-noarch] +name=Ceph noarch packages +baseurl=http://ceph.com/rpm-hammer/rhel7/noarch +enabled=1 +priority=2 +gpgcheck=1 +type=rpm-md +gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc +EOF + yum update -y yum install createrepo -y yum install tar -y @@ -58,6 +81,12 @@ find /var/cache/yum/ -name *.rpm | xargs -i cp {} /centos7-juno-ppa/Packages/ rm /centos7-juno-ppa/Packages/selinux-policy* -f rm /centos7-juno-ppa/Packages/systemd* -f +mv /epel-release-7-5.noarch.rpm /centos7-juno-ppa/Packages/ cp /comps.xml /centos7-juno-ppa/ +cp /ceph_key_release.asc /centos7-juno-ppa/ createrepo -g comps.xml /centos7-juno-ppa +mkdir /centos7-juno-ppa/noarch +mkdir /centos7-juno-ppa/noarch/Packages +cp -r /centos7-juno-ppa/Packages/ceph* /centos7-juno-ppa/noarch/Packages/ +cp -r /centos7-juno-ppa/repodata/ /centos7-juno-ppa/noarch/ tar -zcvf /centos7-juno-ppa.tar.gz /centos7-juno-ppa 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_Debian.yml index f897c944..f897c944 100644 --- a/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install.yml +++ b/deploy/adapters/ansible/roles/ceph-deploy/tasks/ceph_install_Debian.yml 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: [] |