File: connectceph.sh

package info (click to toggle)
ceph 18.2.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,186,140 kB
  • sloc: cpp: 6,278,388; ansic: 3,507,431; python: 372,964; asm: 216,381; java: 133,450; sh: 125,043; xml: 39,398; ruby: 32,026; makefile: 29,004; javascript: 23,994; cs: 18,980; perl: 9,708; sql: 7,833; lisp: 5,920; pascal: 3,109; ada: 1,681; yacc: 478; awk: 188; f90: 55; php: 1
file content (44 lines) | stat: -rwxr-xr-x 2,662 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#
# Connect openstack node just installed to a ceph cluster.
#
# Essentially implements:
#
# http://docs.ceph.com/en/latest/rbd/rbd-openstack/
#
# The directory named files contains templates for the /etc/glance/glance-api.conf,
# /etc/cinder/cinder.conf, /etc/nova/nova.conf Openstack files
#
set -fv
source ./copy_func.sh
source ./fix_conf_file.sh
openstack_node=${1}
ceph_node=${2}

scp $ceph_node:/etc/ceph/ceph.conf ./ceph.conf
ssh $openstack_node sudo mkdir /etc/ceph
copy_file ceph.conf $openstack_node /etc/ceph 0644
rm -f ceph.conf
ssh $openstack_node sudo yum -y install python-rbd
ssh $openstack_node sudo yum -y install ceph-common
ssh $ceph_node "sudo ceph auth get-or-create client.cinder mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rwx pool=vms, allow rx pool=images'"
ssh $ceph_node "sudo ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'"
ssh $ceph_node "sudo ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups'"
ssh $ceph_node sudo ceph auth get-or-create client.glance mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=images'
ssh $ceph_node sudo ceph auth get-or-create client.cinder-backup mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=backups'
ssh $ceph_node sudo ceph auth get-or-create client.glance | ssh $openstack_node sudo tee /etc/ceph/ceph.client.glance.keyring
ssh $openstack_node sudo chown glance:glance /etc/ceph/ceph.client.glance.keyring
ssh $ceph_node sudo ceph auth get-or-create client.cinder | ssh $openstack_node sudo tee /etc/ceph/ceph.client.cinder.keyring
ssh $openstack_node sudo chown cinder:cinder /etc/ceph/ceph.client.cinder.keyring
ssh $ceph_node sudo ceph auth get-or-create client.cinder-backup | ssh $openstack_node sudo tee /etc/ceph/ceph.client.cinder-backup.keyring
ssh $openstack_node sudo chown cinder:cinder /etc/ceph/ceph.client.cinder-backup.keyring
ssh $ceph_node sudo ceph auth get-key client.cinder | ssh $openstack_node tee client.cinder.key
copy_file execs/libvirt-secret.sh $openstack_node .
secret_msg=`ssh $openstack_node sudo ./libvirt-secret.sh $openstack_node`
secret_virt=`echo $secret_msg | sed 's/.* set //'`
echo $secret_virt
fix_conf_file $openstack_node glance-api /etc/glance
fix_conf_file $openstack_node cinder /etc/cinder $secret_virt
fix_conf_file $openstack_node nova /etc/nova $secret_virt
copy_file execs/start_openstack.sh $openstack_node . 0755
ssh $openstack_node ./start_openstack.sh