From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- .../openstack/ceph_install_w_ansible/README | 32 ++++++++++++++++++ .../ceph_install_w_ansible/ceph_install.sh | 39 ++++++++++++++++++++++ .../openstack/ceph_install_w_ansible/config | 5 +++ .../openstack/ceph_install_w_ansible/copy_func.sh | 1 + .../ceph_install_w_ansible/execs/cdn_setup.sh | 20 +++++++++++ .../ceph_install_w_ansible/execs/ceph_ansible.sh | 36 ++++++++++++++++++++ .../execs/edit_ansible_hosts.sh | 17 ++++++++++ .../execs/edit_groupvars_osds.sh | 13 ++++++++ .../ceph_install_w_ansible/multi_action.sh | 19 +++++++++++ .../openstack/ceph_install_w_ansible/repolocs.sh | 8 +++++ .../openstack/ceph_install_w_ansible/staller.sh | 15 +++++++++ .../openstack/ceph_install_w_ansible/talknice.sh | 29 ++++++++++++++++ 12 files changed, 234 insertions(+) create mode 100644 qa/qa_scripts/openstack/ceph_install_w_ansible/README create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/ceph_install.sh create mode 100644 qa/qa_scripts/openstack/ceph_install_w_ansible/config create mode 120000 qa/qa_scripts/openstack/ceph_install_w_ansible/copy_func.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/execs/cdn_setup.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/execs/ceph_ansible.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_ansible_hosts.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_groupvars_osds.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/multi_action.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/repolocs.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/staller.sh create mode 100755 qa/qa_scripts/openstack/ceph_install_w_ansible/talknice.sh (limited to 'qa/qa_scripts/openstack/ceph_install_w_ansible') 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 index 00000000..282c46e4 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/README @@ -0,0 +1,32 @@ + +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 + +If you want to set the monitor_interface or the public_network values, +in your home directory create a file named ip_info (~/ip_info), that +contains the following lines: + +mon_intf=your-monitor-interface (default is eno1) +pub_netw=public-network (default is 10.8.128.0/21) + +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 index 00000000..b4d14f9c --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/ceph_install.sh @@ -0,0 +1,39 @@ +#! /usr/bin/env bash +if [ $# -ne 5 ]; then + echo 'Usage: ceph_install.sh ' + 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 +if [ -e ~/ip_info ]; then + copy_file ~/ip_info $adminnode . 0777 ubuntu:ubuntu +fi +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 index 00000000..a7d81986 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/config @@ -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 index 00000000..6a36be7b --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/copy_func.sh @@ -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 index 00000000..0c87039d --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/cdn_setup.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env bash +if [ -f ~/secrets ]; then + source ~/secrets +fi +subm=`which subscription-manager` +if [ ${#subm} -eq 0 ]; then + sudo yum -y update + exit +fi +subst=`sudo subscription-manager status | grep "^Overall" | awk '{print $NF}'` +if [ $subst == 'Unknown' ]; then + 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 +fi +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 index 00000000..8581de60 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/ceph_ansible.sh @@ -0,0 +1,36 @@ +#! /usr/bin/env 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/ +if [ -f ~/ip_info ]; then + source ~/ip_info +fi +mon_intf=${mon_intf:-'eno1'} +pub_netw=${pub_netw:-'10.8.128.0\/21'} +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: ${mon_intf}/" all +sudo sed -i 's/#journal_size:.*/journal_size: 1024/' all +sudo sed -i "s/#public_network:.*/public_network: ${pub_netw}/" 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 index 00000000..7eb0b701 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_ansible_hosts.sh @@ -0,0 +1,17 @@ +#! /usr/bin/env 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 index 00000000..751658b0 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/execs/edit_groupvars_osds.sh @@ -0,0 +1,13 @@ +#! /usr/bin/env 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 index 00000000..abc368b0 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/multi_action.sh @@ -0,0 +1,19 @@ +#! /usr/bin/env 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 index 00000000..5d82f35d --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/repolocs.sh @@ -0,0 +1,8 @@ +#! /usr/bin/env 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 index 00000000..99c00da3 --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/staller.sh @@ -0,0 +1,15 @@ +#! /usr/bin/env 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 index 00000000..ffed4f1d --- /dev/null +++ b/qa/qa_scripts/openstack/ceph_install_w_ansible/talknice.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env 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 -- cgit v1.2.3