-
Notifications
You must be signed in to change notification settings - Fork 4
/
config.no-gen.sh
executable file
·65 lines (57 loc) · 2.37 KB
/
config.no-gen.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# don't generate if file already exists
set -e
function get_admin_key {
# No-op for static
echo "static: does not generate admin key"
}
function get_mon_config {
if [ ! -e /etc/ceph/${CLUSTER}.conf ]; then
fsid=$(uuidgen)
cat <<ENDHERE >/etc/ceph/${CLUSTER}.conf
[global]
fsid = $fsid
mon initial members = ${MON_NAME}
mon host = ${MON_IP}
auth cluster required = cephx
auth service required = cephx
auth client required = cephx
public network = ${CEPH_PUBLIC_NETWORK}
cluster network = ${CEPH_CLUSTER_NETWORK}
osd journal size = ${OSD_JOURNAL_SIZE}
ENDHERE
if [[ ! -z "$(ip -6 -o a | grep scope.global | awk '/eth/ { sub ("/..", "", $4); print $4 }' | head -n1)" ]]; then
echo "ms_bind_ipv6 = true" >> /etc/ceph/${CLUSTER}.conf
sed -i '/mon host/d' /etc/ceph/${CLUSTER}.conf
echo "mon host = ${MON_IP}" >> /etc/ceph/${CLUSTER}.conf
fi
else
fsid=`grep "fsid" /etc/ceph/${CLUSTER}.conf |awk '{print $NF}'`
fi
if [ ! -e /etc/ceph/${CLUSTER}.client.admin.keyring ]; then
# Generate administrator key
ceph-authtool /etc/ceph/${CLUSTER}.client.admin.keyring --create-keyring --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'allow *' --cap mds 'allow'
fi
if [ ! -e /etc/ceph/${CLUSTER}.mon.keyring ]; then
# Generate the mon. key
ceph-authtool /etc/ceph/${CLUSTER}.mon.keyring --create-keyring --gen-key -n mon. --cap mon 'allow *'
fi
# Create bootstrap key directories
mkdir -p /var/lib/ceph/bootstrap-{osd,mds,rgw}
if [ ! -e /var/lib/ceph/bootstrap-osd/${CLUSTER}.keyring ]; then
# Generate the OSD bootstrap key
ceph-authtool /var/lib/ceph/bootstrap-osd/${CLUSTER}.keyring --create-keyring --gen-key -n client.bootstrap-osd --cap mon 'allow profile bootstrap-osd'
fi
if [ ! -e /var/lib/ceph/bootstrap-mds/${CLUSTER}.keyring ]; then
# Generate the MDS bootstrap key
ceph-authtool /var/lib/ceph/bootstrap-mds/${CLUSTER}.keyring --create-keyring --gen-key -n client.bootstrap-mds --cap mon 'allow profile bootstrap-mds'
fi
if [ ! -e /var/lib/ceph/bootstrap-rgw/${CLUSTER}.keyring ]; then
# Generate the RGW bootstrap key
ceph-authtool /var/lib/ceph/bootstrap-rgw/${CLUSTER}.keyring --create-keyring --gen-key -n client.bootstrap-rgw --cap mon 'allow profile bootstrap-rgw'
fi
}
function get_config {
# No-op for static
echo "static: does not generate config"
}