From cb5ae68b968f28c1cedee3720ff14cf5fa1ab92c Mon Sep 17 00:00:00 2001 From: baigk Date: Mon, 9 Nov 2015 00:37:19 -0800 Subject: suport installing openstack kilo on centos 7 JIRA: COMPASS-141 Change-Id: I8b4eeacd802124cd05d17c7c24682254f0c567f7 Signed-off-by: baigk --- build.sh | 7 +- build/build.conf | 7 +- build/make_repo.sh | 4 + build/os/centos/rhel7/kilo/Dockerfile.tmpl | 27 ++++++ build/templates/RedHat_kilo.tmpl | 100 +++++++++++++++++++++ .../adapters/ansible/roles/common/tasks/main.yml | 7 +- .../adapters/ansible/roles/common/vars/Debian.yml | 4 + .../adapters/ansible/roles/common/vars/RedHat.yml | 6 +- .../ansible/roles/database/tasks/mongodb.yml | 6 +- .../ansible/roles/database/vars/Debian.yml | 4 + .../ansible/roles/database/vars/RedHat.yml | 10 +++ .../ansible/roles/setup-network/tasks/main.yml | 2 +- deploy/compass_vm.sh | 1 + deploy/conf/cluster.conf | 11 ++- 14 files changed, 186 insertions(+), 10 deletions(-) create mode 100644 build/os/centos/rhel7/kilo/Dockerfile.tmpl create mode 100644 build/templates/RedHat_kilo.tmpl diff --git a/build.sh b/build.sh index cffceecf..6ec5bfb3 100755 --- a/build.sh +++ b/build.sh @@ -65,7 +65,8 @@ function download_local() function download_packages() { for i in $CENTOS_BASE $COMPASS_CORE $COMPASS_WEB $COMPASS_INSTALL $TRUSTY_JUNO_PPA $UBUNTU_ISO \ - $CENTOS_ISO $CENTOS7_JUNO_PPA $LOADERS $CIRROS $APP_PACKAGE $COMPASS_PKG $PIP_REPO $ANSIBLE_MODULE; do + $CENTOS_ISO $CENTOS7_JUNO_PPA $CENTOS7_KILO_PPA $LOADERS $CIRROS $APP_PACKAGE $COMPASS_PKG \ + $PIP_REPO $ANSIBLE_MODULE; do if [[ ! $i ]]; then continue @@ -111,6 +112,10 @@ function copy_file() cp $CACHE_DIR/`basename $CENTOS7_JUNO_PPA` $new/repos/cobbler/centos/ppa/ -rf fi + if [[ $CENTOS7_KILO_PPA ]]; then + cp $CACHE_DIR/`basename $CENTOS7_KILO_PPA` $new/repos/cobbler/centos/ppa/ -rf + fi + cp $CACHE_DIR/`basename $LOADERS` $new/ -rf || exit 1 cp $CACHE_DIR/`basename $APP_PACKAGE` $new/app_packages/ -rf || exit 1 cp $CACHE_DIR/`basename $ANSIBLE_MODULE | sed 's/.git//g'` $new/ansible/ -rf || exit 1 diff --git a/build/build.conf b/build/build.conf index c6f0bdef..2f2025c3 100644 --- a/build/build.conf +++ b/build/build.conf @@ -6,10 +6,11 @@ export CENTOS_BASE=${CENTOS_BASE:-$PACKAGE_URL/centos_base.iso} export COMPASS_CORE=${COMPASS_CORE:-http://github.com/baigk/compass-core.git} export COMPASS_WEB=${COMPASS_WEB:-http://github.com/baigk/compass-web.git} export COMPASS_INSTALL=${COMPASS_INSTALL:-http://github.com/baigk/compass-install.git} -export TRUSTY_JUNO_PPA=${TRUSTY_JUNO_PPA:-$PACKAGE_URL/trusty-juno-ppa.tar.gz} export UBUNTU_ISO=${UBUNTU_ISO:-$PACKAGE_URL/ubuntu-14.04.3-server-amd64.iso} +export TRUSTY_JUNO_PPA=${TRUSTY_JUNO_PPA:-$PACKAGE_URL/trusty-juno-ppa.tar.gz} export CENTOS_ISO=${CENTOS_ISO:-$PACKAGE_URL/CentOS-7-x86_64-Minimal-1503-01.iso} export CENTOS7_JUNO_PPA=${CENTOS7_JUNO_PPA:-$PACKAGE_URL/centos7-juno-ppa.tar.gz} +#export CENTOS7_KILO_PPA=${CENTOS7_KILO_PPA:-$PACKAGE_URL/centos7-kilo-ppa.tar.gz} export COMPASS_PKG=${COMPASS_PKG:-$PACKAGE_URL/centos6-package.tar.gz} export LOADERS=${LOADERS:-$PACKAGE_URL/loaders.tar.gz} export CIRROS=${CIRROS:-$PACKAGE_URL/cirros-0.3.3-x86_64-disk.img} @@ -71,4 +72,6 @@ export PIP_CONF="https://bootstrap.pypa.io/ez_setup.py \ https://pypi.python.org/packages/source/o/ordereddict/ordereddict-1.0.tar.gz \ https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz \ https://pypi.python.org/packages/source/l/lazypy/lazypy-0.5.tar.gz \ - https://pypi.python.org/packages/source/p/pycrypto-on-pypi/pycrypto-on-pypi-2.3.tar.gz" + https://pypi.python.org/packages/source/p/pycrypto-on-pypi/pycrypto-on-pypi-2.3.tar.gz \ + https://pypi.python.org/packages/2.6/p/pymongo/pymongo-3.0.3-cp26-none-macosx_10_10_intel.whl \ + https://pypi.python.org/packages/source/c/crudini/crudini-0.7.tar.gz" diff --git a/build/make_repo.sh b/build/make_repo.sh index c58a032c..4357fbd1 100755 --- a/build/make_repo.sh +++ b/build/make_repo.sh @@ -178,6 +178,10 @@ function make_all_repo() 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" + + make_repo --os-ver rhel7 --package-tag kilo \ + --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.5 dracut-network-033-241.el7_1.5" } function main() diff --git a/build/os/centos/rhel7/kilo/Dockerfile.tmpl b/build/os/centos/rhel7/kilo/Dockerfile.tmpl new file mode 100644 index 00000000..34945d00 --- /dev/null +++ b/build/os/centos/rhel7/kilo/Dockerfile.tmpl @@ -0,0 +1,27 @@ +FROM centos:7.1.1503 +MAINTAINER Chigang(Justin) + +# set cache enable +RUN sed -i 's/keepcache=0/keepcache=1/g' /etc/yum.conf +#set packages = $getVar('spcial_packages', []) +#for package in $packages +ADD ./RedHat/packages/$package /var/cache/yum/x86_64/7/base/packages/ +#end for +#set scripts = $getVar('scripts', []) +#for script in $scripts +ADD ./RedHat/script/$script /tmp/chigang/$script +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 + +ADD ./cp_repo.sh /tmp/chigang/cp_repo.sh +RUN chmod +x /tmp/chigang/cp_repo.sh +RUN mkdir /result + +CMD ["/tmp/chigang/cp_repo.sh"] +#VOLUME /tmp/chigang diff --git a/build/templates/RedHat_kilo.tmpl b/build/templates/RedHat_kilo.tmpl new file mode 100644 index 00000000..3d587250 --- /dev/null +++ b/build/templates/RedHat_kilo.tmpl @@ -0,0 +1,100 @@ +#!/bin/bash +set -x + +yum remove systemd -y +# add 163 repo +yum install wget -y +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 +# add openstack kilo repo +yum install yum-plugin-priorities -y +yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm -y +yum install http://rdo.fedorapeople.org/openstack-kilo/rdo-release-kilo.rpm -y + +# modify centos7 repo for workaround +sed -i 's/epel-Derived from Red Hat Enterprise Linux 7.1 (Source)/epel-7/g' /etc/yum.repos.d/rdo-release.repo + +# add galeracluster repo +cat </etc/yum.repos.d/MariaDB.repo +[mariadb] +name =MariaDB +baseurl = http://yum.mariadb.org/5.5/centos7-amd64 +gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB +gpgcheck=1 +EOF + +cat </etc/yum.repos.d/syslog.repo +[rsyslog_v7] +name=rsyslog +baseurl="http://rpms.adiscon.com/v7-stable/epel-7/x86_64" +enabled=1 +gpgcheck=0 +gpgkey=http://rpms.adiscon.com/RPM-GPG-KEY-Adiscon +protect=1 +EOF + +cat </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 + +cat </etc/yum.repos.d/mongo.repo +[10gen] +name=10gen Repository +baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 +gpgcheck=0 +EOF + +yum update -y +yum install createrepo -y +yum install tar -y + +#download packages +#set packages = $getVar('default_packages', []) +#for pkg in $packages +yum -y install $pkg --downloadonly +#end for +#set packages = $getVar('packages', []) +#for pkg in $packages +yum -y install $pkg --downloadonly +#end for + +#make repo + +mkdir -p /centos7-kilo-ppa/{Packages,repodata} + +find /var/cache/yum/ -name "*.rpm" | xargs -i cp {} /centos7-kilo-ppa/Packages/ + +rm /centos7-kilo-ppa/Packages/selinux-policy* -f +rm /centos7-kilo-ppa/Packages/systemd* -f +rm /centos7-kilo-ppa/Packages/openssl-1.0.1e-42.el7.9.x86_64.rpm +rm /centos7-kilo-ppa/Packages/libnl3-3.2.21-9.el7_1.x86_64.rpm + +mv /epel-release-7-5.noarch.rpm /centos7-kilo-ppa/Packages/ +cp /comps.xml /centos7-kilo-ppa/ +cp /ceph_key_release.asc /centos7-kilo-ppa/ +createrepo -g comps.xml /centos7-kilo-ppa +mkdir /centos7-kilo-ppa/noarch +mkdir /centos7-kilo-ppa/noarch/Packages +cp -r /centos7-kilo-ppa/Packages/ceph* /centos7-kilo-ppa/noarch/Packages/ +cp -r /centos7-kilo-ppa/repodata/ /centos7-kilo-ppa/noarch/ +tar -zcvf /centos7-kilo-ppa.tar.gz /centos7-kilo-ppa diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml index 04a18a83..3114e638 100644 --- a/deploy/adapters/ansible/roles/common/tasks/main.yml +++ b/deploy/adapters/ansible/roles/common/tasks/main.yml @@ -5,6 +5,11 @@ apt: pkg=landscape-common state=absent purge=yes when: ansible_os_family == "Debian" + +- name: install pip packages + pip: name={{ item }} state=present extra_args='--pre' + with_items: pip_packages + - name: update hosts files to all hosts template: src=hosts dest=/etc/hosts backup=yes @@ -35,7 +40,7 @@ file: path=~/.pip state=directory - name: update pip.conf - template: src=pip.conf dest=~/.pip/pip.conf + template: src=pip.conf dest=~/.pip/{{ pip_conf }} - name: update ntp conf template: src=ntp.conf dest=/etc/ntp.conf backup=yes diff --git a/deploy/adapters/ansible/roles/common/vars/Debian.yml b/deploy/adapters/ansible/roles/common/vars/Debian.yml index c471d148..bc273a10 100644 --- a/deploy/adapters/ansible/roles/common/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/common/vars/Debian.yml @@ -6,6 +6,10 @@ packages: - openvswitch-switch - crudini +pip_packages: [] + +pip_conf: pip.conf + services: [] ntp_service: ntp diff --git a/deploy/adapters/ansible/roles/common/vars/RedHat.yml b/deploy/adapters/ansible/roles/common/vars/RedHat.yml index 57172b7f..10aa7715 100644 --- a/deploy/adapters/ansible/roles/common/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/common/vars/RedHat.yml @@ -1,8 +1,12 @@ --- packages: - - python-devel - openvswitch +pip_packages: + - crudini + +pip_conf: .pip.conf + services: - openvswitch diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml index 5ca23a19..c46a2932 100644 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb.yml +++ b/deploy/adapters/ansible/roles/database/tasks/mongodb.yml @@ -3,6 +3,10 @@ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: mongodb_packages | union(packages_noarch) +- name: install pymongod packages + pip: name={{ item }} state=present extra_args='--pre' + with_items: pip_packages + - name: copy ceilometer configs template: src=mongodb.conf dest=/opt/os_templates backup=yes @@ -17,7 +21,7 @@ - /var/lib/mongodb/journal/* - name: manually restart mongodb server - service: name=mongodb state=restarted + service: name={{ mongodb_serveice }} state=restarted - wait_for: port=27017 delay=3 timeout=60 host={{ internal_vip.ip }} diff --git a/deploy/adapters/ansible/roles/database/vars/Debian.yml b/deploy/adapters/ansible/roles/database/vars/Debian.yml index 6f085ffd..7035c2bf 100644 --- a/deploy/adapters/ansible/roles/database/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/database/vars/Debian.yml @@ -15,8 +15,12 @@ maridb_packages: - mysql-wsrep-server-5.5 - galera-3 +pip_packages: [] + services: [] +mongodb_serveice: mongodb + mysql_config_file_path: "/etc/mysql" mysql_config_file_name: ["my.cnf"] wsrep_config_file_path: "/etc/mysql/conf.d" diff --git a/deploy/adapters/ansible/roles/database/vars/RedHat.yml b/deploy/adapters/ansible/roles/database/vars/RedHat.yml index a4171559..ac2f2f22 100644 --- a/deploy/adapters/ansible/roles/database/vars/RedHat.yml +++ b/deploy/adapters/ansible/roles/database/vars/RedHat.yml @@ -4,13 +4,23 @@ mysql_packages: - mysql-server maridb_packages: + - MySQL-python - MariaDB-Galera-server - MariaDB-client - galera - MySQL-python +mongodb_packages: + - mongo-10gen-server + - mongo-10gen + +pip_packages: + - pymongo + services: [] +mongodb_serveice: mongod + mysql_config_file_path: "/etc/my.cnf.d" mysql_config_file_name: ["my-huge.cnf", "server.cnf"] wsrep_config_file_path: "/etc/my.cnf.d" diff --git a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml index 8667a9b1..818ac57a 100644 --- a/deploy/adapters/ansible/roles/setup-network/tasks/main.yml +++ b/deploy/adapters/ansible/roles/setup-network/tasks/main.yml @@ -24,7 +24,7 @@ - setup_networks/setup_networks.py - name: copy boot scripts - copy: src={{ item }} dest=/etc/init.d mode=0755 + copy: src={{ item }} dest=/etc/init.d/ mode=0755 with_items: - setup_networks/net_init diff --git a/deploy/compass_vm.sh b/deploy/compass_vm.sh index 3ba20266..958bf33b 100644 --- a/deploy/compass_vm.sh +++ b/deploy/compass_vm.sh @@ -38,6 +38,7 @@ function wait_ok() { sleep 1 let retry+=1 if [[ $retry -ge $1 ]];then + timeout 1s ssh $ssh_args root@$MGMT_IP "exit" log_error "os install time out" exit 1 fi diff --git a/deploy/conf/cluster.conf b/deploy/conf/cluster.conf index b905957d..39e6d467 100644 --- a/deploy/conf/cluster.conf +++ b/deploy/conf/cluster.conf @@ -1,9 +1,14 @@ export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)ubuntu-14\.04\.3.*'} -#export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)CentOS-7.*1503-01.*'} export REPO_NAME=${REPO_NAME:-"trusty-juno-ppa"} -#export REPO_NAME=${REPO_NAME:-"centos7-juno-ppa"} export ADAPTER_NAME="openstack_juno" export ADAPTER_TARGET_SYSTEM_PATTERN="^openstack$" -export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes" +export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-juno" + +#export ADAPTER_OS_PATTERN=${ADAPTER_OS_PATTERN:-'(?i)CentOS-7.*1503-01.*'} +#export REPO_NAME=${REPO_NAME:-"centos7-kilo-ppa"} +#export ADAPTER_NAME="openstack_kilo" +#export ADAPTER_TARGET_SYSTEM_PATTERN="^openstack$" +#export ADAPTER_FLAVOR_PATTERN="HA-ansible-multinodes-kilo" + export DEFAULT_ROLES="" export VIP="10.1.0.222" -- cgit 1.2.3-korg