]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add ceph-ansible installer.
authorWarren Usui <wusui@magna002.ceph.redhat.com>
Thu, 21 Jul 2016 21:03:13 +0000 (17:03 -0400)
committerWarren Usui <wusui@magna002.ceph.redhat.com>
Thu, 21 Jul 2016 21:03:13 +0000 (17:03 -0400)
Also fix iso rhel handling in openstack script
Updated openstack README.

Fixes: http://tracker.ceph.com/issues/16770
Signed-off-by: Warren Usui <wusui@redhat.com>
15 files changed:
qa/qa_scripts/openstack/README
qa/qa_scripts/openstack/ceph_install_w_ansible/README [new file with mode: 0644]
qa/qa_scripts/openstack/ceph_install_w_ansible/ceph_install.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/config [new file with mode: 0644]
qa/qa_scripts/openstack/ceph_install_w_ansible/copy_func.sh [new symlink]
qa/qa_scripts/openstack/ceph_install_w_ansible/execs/cdn_setup.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/execs/ceph_ansible.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_ansible_hosts.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_groupvars_osds.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/multi_action.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/repolocs.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/staller.sh [new file with mode: 0755]
qa/qa_scripts/openstack/ceph_install_w_ansible/talknice.sh [new file with mode: 0755]
qa/qa_scripts/openstack/image_create.sh
qa/qa_scripts/openstack/openstack.sh

index 4b59317117667674ee6de7a7214a5130921b52e3..63fe2d973d72fcfa5696ac3df60a51629a4ab65d 100644 (file)
@@ -10,9 +10,23 @@ If further development is necessary in the future, these templates should
 probably be removed and direct editing of the OpenStack conf files should
 probably be performed.
 
-These scripts also assume that there is a  rhel iso file named
-rhel-server-7.2-x86_64-boot.iso and a ceph iso file named
-rhceph-1.3.1-rhel-7-x86_64-dvd.iso in the files directory.  These iso files
-can be obtained from the rhel site and are not stored with these scripts.
+These scripts also assume that either there is a rhel iso file named
+rhel-server-7.2-x86_64-boot.iso in the user's home directory, or the
+exported variable RHEL_ISO is set to point at an existing rhel iso file.
+If one is also running the ceph-deploy based ceph_install.sh, this script
+also assumes that there is a file named rhceph-1.3.1-rhel-7-x86_64-dvd.iso
+in the files directory.  These iso files can be obtained from the rhel site
+and are not stored with these scripts.
 
+To install openstack:
+./openstack.sh <openstack-admin-node> <ceph-monitor-node>
+
+This assumes that the ceph cluster is already set up.
+
+To setup a ceph-cluster using an iso and ceph-deploy:
+./ceph_install.sh <admin-node> <mon-node> <osd-node> <osd-node> <osd-node>
+
+To setup a ceph-cluster using the cdn and ceph-ansible:
+cd ceph_install_w_ansible
+./ceph_install.sh <admin-node> <mon-node> <osd-node> <osd-node> <osd-node>
 
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/README b/qa/qa_scripts/openstack/ceph_install_w_ansible/README
new file mode 100644 (file)
index 0000000..bed8bad
--- /dev/null
@@ -0,0 +1,24 @@
+ceph_install.sh installs a ceph cluster using the cdn and ceph-ansible.
+
+Right now, it takes 5 parameters -- an admin node, a ceph mon node, and
+three osd nodes.
+
+In order to subscribe to the cdn, in your home directory create a file named
+secrets, (~/secrets), that contains the following lines:
+
+subscrname=Your-Redhat-Cdn-Id
+subscrpassword=Your-Redhat-Cdn-Password
+
+This script first subscribes to the cdn, enables the rhel 7 repos, and does
+a yum update.  (multi_action.sh performs all the actions on all nodes at once,
+staller.sh is used to make sure that all updates are complete before exiting,
+and execs/cdn_setup.sh is used to remotely update the cdn information.
+
+After that, it makes sure that all nodes can connect via passwordless ssh
+(using talknice.sh and config) and then installs the appropriate repos and
+runs ceph_ansible on the admin node using execs/ceph_ansible.sh,
+execs/edit_ansible_hosts.sh and execs/edit_groupvars_osds.sh.
+
+repolocs.sh contains the locations of repo files.  These variables can
+be changed if one wishes to use different urls.
+
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/ceph_install.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/ceph_install.sh
new file mode 100755 (executable)
index 0000000..72f0db1
--- /dev/null
@@ -0,0 +1,36 @@
+#! /bin/bash
+if [ $# -ne 5 ]; then
+    echo 'Usage: ceph_install.sh <admin-node> <mon-node> <osd-node> <osd-node> <osd-node>'
+    exit -1
+fi
+allnodes=$*
+adminnode=$1
+shift
+cephnodes=$*
+monnode=$1
+shift
+osdnodes=$*
+./multi_action.sh cdn_setup.sh $allnodes
+./talknice.sh $allnodes
+for mac in $allnodes; do
+    ssh $mac sudo yum -y install yum-utils
+done
+
+source ./repolocs.sh
+ssh $adminnode sudo yum-config-manager --add ${CEPH_REPO_TOOLS}
+ssh $monnode sudo yum-config-manager --add ${CEPH_REPO_MON}
+for mac in $osdnodes; do
+    ssh $mac sudo yum-config-manager --add ${CEPH_REPO_OSD}
+done
+ssh $adminnode sudo yum-config-manager --add ${INSTALLER_REPO_LOC}
+
+for mac in $allnodes; do
+    ssh $mac sudo sed -i 's/gpgcheck=1/gpgcheck=0/' /etc/yum.conf
+done
+
+source copy_func.sh
+copy_file execs/ceph_ansible.sh $adminnode . 0777 ubuntu:ubuntu
+copy_file execs/edit_ansible_hosts.sh $adminnode . 0777 ubuntu:ubuntu
+copy_file execs/edit_groupvars_osds.sh $adminnode . 0777 ubuntu:ubuntu
+copy_file ../execs/ceph-pool-create.sh $monnode . 0777 ubuntu:ubuntu
+ssh $adminnode ./ceph_ansible.sh $cephnodes
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/config b/qa/qa_scripts/openstack/ceph_install_w_ansible/config
new file mode 100644 (file)
index 0000000..a7d8198
--- /dev/null
@@ -0,0 +1,5 @@
+Host plana* mira* burnupi* tala* saya* vpm* names* gitbuilder* teuthology gw* senta* vercoi* rex* magna*
+  ServerAliveInterval 360
+  StrictHostKeyChecking no
+  UserKnownHostsFile=/dev/null
+  User ubuntu
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/copy_func.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/copy_func.sh
new file mode 120000 (symlink)
index 0000000..6a36be7
--- /dev/null
@@ -0,0 +1 @@
+../copy_func.sh
\ No newline at end of file
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/cdn_setup.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/cdn_setup.sh
new file mode 100755 (executable)
index 0000000..76cc07e
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/bash
+if [ -f ~/secrets ]; then
+    source ~/secrets
+fi
+mynameis=${subscrname:-'inigomontoya'}
+mypassis=${subscrpassword:-'youkeelmyfatherpreparetodie'}
+sudo subscription-manager register --username=$mynameis --password=$mypassis --force
+sudo subscription-manager refresh
+if [ $? -eq 1 ]; then exit 1; fi
+sudo subscription-manager attach --pool=8a85f9823e3d5e43013e3ddd4e2a0977
+sudo subscription-manager repos --enable=rhel-7-server-rpms
+sudo yum -y update
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/ceph_ansible.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/ceph_ansible.sh
new file mode 100755 (executable)
index 0000000..d25dc34
--- /dev/null
@@ -0,0 +1,31 @@
+#! /bin/bash
+cephnodes=$*
+monnode=$1
+sudo yum -y install ceph-ansible
+cd
+sudo ./edit_ansible_hosts.sh $cephnodes
+mkdir ceph-ansible-keys
+cd /usr/share/ceph-ansible/group_vars/
+sudo cp all.sample all
+sudo sed -i 's/#ceph_origin:.*/ceph_origin: distro/' all
+sudo sed -i 's/#fetch_directory:.*/fetch_directory: ~\/ceph-ansible-keys/' all
+sudo sed -i 's/#ceph_stable:.*/ceph_stable: true/' all
+sudo sed -i 's/#ceph_stable_rh_storage:.*/ceph_stable_rh_storage: false/' all
+sudo sed -i 's/#ceph_stable_rh_storage_cdn_install:.*/ceph_stable_rh_storage_cdn_install: true/' all
+sudo sed -i 's/#cephx:.*/cephx: true/' all
+sudo sed -i 's/#monitor_interface:.*/monitor_interface: eno1/' all
+sudo sed -i 's/#journal_size:.*/journal_size: 1024/' all
+sudo sed -i 's/#public_network:.*/public_network: 10.8.128.0\/21/' all
+sudo cp osds.sample osds
+sudo sed -i 's/#fetch_directory:.*/fetch_directory: ~\/ceph-ansible-keys/' osds
+sudo sed -i 's/#crush_location:/crush_location:/' osds
+sudo sed -i 's/#osd_crush_location:/osd_crush_location:/' osds
+sudo sed -i 's/#cephx:/cephx:/' osds
+sudo sed -i 's/#devices:/devices:/' osds
+sudo sed -i 's/#journal_collocation:.*/journal_collocation: true/' osds
+cd
+sudo ./edit_groupvars_osds.sh
+cd /usr/share/ceph-ansible
+sudo cp site.yml.sample site.yml
+ansible-playbook site.yml
+ssh $monnode ~/ceph-pool-create.sh
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_ansible_hosts.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_ansible_hosts.sh
new file mode 100755 (executable)
index 0000000..c3d8df6
--- /dev/null
@@ -0,0 +1,17 @@
+#! /bin/bash
+ed /etc/ansible/hosts << EOF
+$
+a
+
+[mons]
+${1}
+
+[osds]
+${2}
+${3}
+${4}
+
+.
+w
+q
+EOF
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_groupvars_osds.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_groupvars_osds.sh
new file mode 100755 (executable)
index 0000000..a62ef14
--- /dev/null
@@ -0,0 +1,13 @@
+#! /bin/bash
+ed /usr/share/ceph-ansible/group_vars/osds << EOF
+$
+/^devices:
+.+1
+i
+   - /dev/sdb
+   - /dev/sdc
+   - /dev/sdd
+.
+w
+q
+EOF
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/multi_action.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/multi_action.sh
new file mode 100755 (executable)
index 0000000..9fc2dde
--- /dev/null
@@ -0,0 +1,19 @@
+#! /bin/bash
+source copy_func.sh
+allparms=$*
+cmdv=$1
+shift
+sites=$*
+for mac in $sites; do
+    echo $cmdv $mac
+    if [ -f ~/secrets ]; then
+        copy_file ~/secrets $mac . 0777 ubuntu:ubuntu
+    fi
+    copy_file execs/${cmdv} $mac . 0777 ubuntu:ubuntu
+    ssh $mac ./${cmdv} &
+done
+./staller.sh $allparms
+for mac in $sites; do
+    ssh $mac sudo rm -rf secrets
+done
+echo "DONE"
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/repolocs.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/repolocs.sh
new file mode 100755 (executable)
index 0000000..e4b74af
--- /dev/null
@@ -0,0 +1,8 @@
+#! /bin/bash
+SPECIFIC_VERSION=latest-Ceph-2-RHEL-7 
+#SPECIFIC_VERSION=Ceph-2-RHEL-7-20160630.t.0
+#SPECIFIC_VERSION=Ceph-2.0-RHEL-7-20160718.t.0
+export CEPH_REPO_TOOLS=http://download.eng.bos.redhat.com/rcm-guest/ceph-drops/auto/ceph-2-rhel-7-compose/${SPECIFIC_VERSION}/compose/Tools/x86_64/os/
+export CEPH_REPO_MON=http://download.eng.bos.redhat.com/rcm-guest/ceph-drops/auto/ceph-2-rhel-7-compose/${SPECIFIC_VERSION}/compose/MON/x86_64/os/
+export CEPH_REPO_OSD=http://download.eng.bos.redhat.com/rcm-guest/ceph-drops/auto/ceph-2-rhel-7-compose/${SPECIFIC_VERSION}/compose/OSD/x86_64/os/
+export INSTALLER_REPO_LOC=http://download.eng.bos.redhat.com/rcm-guest/ceph-drops/auto/rhscon-2-rhel-7-compose/latest-RHSCON-2-RHEL-7/compose/Installer/x86_64/os/
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/staller.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/staller.sh
new file mode 100755 (executable)
index 0000000..2e56002
--- /dev/null
@@ -0,0 +1,15 @@
+#! /bin/bash
+cmd_wait=$1
+shift
+sites=$*
+donebit=0
+while [ $donebit -ne 1 ]; do
+    sleep 10
+    donebit=1
+    for rem in $sites; do
+        rval=`ssh $rem ps aux | grep $cmd_wait | wc -l` 
+        if [ $rval -gt 0 ]; then
+            donebit=0
+        fi
+    done
+done
diff --git a/qa/qa_scripts/openstack/ceph_install_w_ansible/talknice.sh b/qa/qa_scripts/openstack/ceph_install_w_ansible/talknice.sh
new file mode 100755 (executable)
index 0000000..6b538cd
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/bash
+declare -A rsapub
+for fulln in $*; do
+    sname=`echo $fulln | sed 's/\..*//'`
+    nhead=`echo $sname | sed 's/[0-9]*//g'`
+    x=`ssh $fulln "ls .ssh/id_rsa"`
+    if [ -z $x ]; then
+        ssh $fulln "ssh-keygen -N '' -f .ssh/id_rsa";
+    fi
+    xx=`ssh $fulln "ls .ssh/config"`
+    if [ -z $xx ]; then
+        scp config $fulln:/home/ubuntu/.ssh/config
+    fi
+    ssh $fulln "chown ubuntu:ubuntu .ssh/config"
+    ssh $fulln "chmod 0600 .ssh/config"
+    rsapub[$fulln]=`ssh $fulln "cat .ssh/id_rsa.pub"`
+done
+for ii in $*; do
+    ssh $ii sudo iptables -F
+    for jj in $*; do
+        pval=${rsapub[$jj]}
+        if [ "$ii" != "$jj" ]; then
+            xxxx=`ssh $ii "grep $jj .ssh/authorized_keys"`
+            if [ -z "$xxxx" ]; then
+                ssh $ii "echo '$pval' | sudo tee -a /home/ubuntu/.ssh/authorized_keys"
+            fi
+        fi
+    done;
+done
index 82e535325dda1b1e145c3eb4c3ed062a79baf07e..4252dd8837aefb794ab8cbd8012da928d72bb03a 100755 (executable)
@@ -1,13 +1,14 @@
 #/bin/bash -fv
 #
-# Set up a vm on packstack.  Use the iso in the files directory.
+# Set up a vm on packstack.  Use the iso in RHEL_ISO (defaults to home dir)
 #
 source ./copy_func.sh
 source ./fix_conf_file.sh
 openstack_node=${1}
 ceph_node=${2}
 
-copy_file files/rhel-server-7.2-x86_64-boot.iso $openstack_node .
+RHEL_ISO=${RHEL_ISO:-~/rhel-server-7.2-x86_64-boot.iso}
+copy_file ${RHEL_ISO} $openstack_node .
 copy_file execs/run_openstack.sh $openstack_node . 0755
 filler=`date +%s`
 ssh $openstack_node ./run_openstack.sh "${openstack_node}X${filler}" rhel-server-7.2-x86_64-boot.iso
index 59921f104bd6870e88f1db7ca8a4a2d18e8e0578..986fce91787494753e263bbf335342986f2cca0f 100755 (executable)
@@ -20,8 +20,8 @@ openstack_node=${1}
 ceph_node=${2}
 ./packstack.sh $openstack_node $ceph_node
 echo 'done running packstack'
-read foo
+sleep 60
 ./connectceph.sh $openstack_node $ceph_node
 echo 'done connecting'
-read foo
+sleep 60
 ./image_create.sh $openstack_node $ceph_node