Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat>/root/install_ceph<<'EOF'
- #!/bin/bash
- display_menu() {
- echo "Choose an option:"
- echo "1. Install Ceph with Snap Microceph"
- echo "2. Install Ceph with cephadm"
- echo "3. Exit"
- }
- install_ceph_snap_microceph() {
- echo "Installing Ceph with Snap Microceph..."
- sudo apt-get update
- sudo apt-get install snap snapd
- sudo snap install microceph
- sudo microceph cluster bootstrap
- sudo microceph enable rgw
- }
- install_ceph_cephadm() {
- echo "Install Ceph with cephadm..."
- # Add your dummy commands here
- host=$(hostname -s)
- ip4=$(ip -o -4 addr list $(ip r|grep "default"|awk '{print $5}') | awk '{print $4}' | cut -d/ -f1)
- apt-get -y install podman ceph-common ceph-base lvm2 \
- ceph-iscsi radosgw nfs-ganesha-ceph cephfs-shell \
- targetcli-fb ceph-iscsi python3-rtslib-fb tcmu-runner
- curl --silent --remote-name --location https://github.com/ceph/ceph/raw/quincy/src/cephadm/cephadm
- chmod +x cephadm
- sudo mv cephadm /usr/local/bin/
- sudo cephadm bootstrap \
- --mon-ip $ip4 \
- --dashboard-password-noupdate \
- --initial-dashboard-user admin \
- --initial-dashboard-password "p@ssw0rd"
- ceph config set mgr mgr/cephadm/manage_etc_ceph_ceph_conf true
- systemctl disable nfs-ganesha
- ceph tell mon.* injectargs '--mon-allow-pool-delete true'
- sleep 5
- ceph orch apply osd --all-available-devices
- sleep 10
- ceph osd pool create cephfs0_data replicated
- ceph osd pool create cephfs0_metadata replicated
- ceph fs new cephfs0 cephfs0_metadata cephfs0_data
- ceph orch apply mds cephfs0 1
- ceph fs authorize cephfs0 client.user / rw | tee /etc/ceph/ceph.client.user.keyring
- mkdir -p /mnt/cephfs0
- cat >> /etc/fstab << FSTABMOUNT
- $ip4:/ /mnt/cephfs0 ceph name=user,noatime,nodiratime,_netdev 0 0
- FSTABMOUNT
- mount -a
- ceph osd pool create rbd
- ceph osd pool application enable rbd rbd
- rbd pool init -p rbd
- radosgw-admin realm create --rgw-realm=default --default
- radosgw-admin zonegroup create --rgw-zonegroup=default --master --default
- radosgw-admin zone create --rgw-zonegroup=default --rgw-zone=default --master --default
- radosgw-admin period update --rgw-realm=default --commit
- ceph orch apply rgw default --realm=default --zone=default --placement="1 $host"
- }
- while true; do
- display_menu
- read -p "Enter your choice (1-3): " choice
- case $choice in
- 1)
- install_ceph_snap_microceph
- ;;
- 2)
- install_ceph_cephadm
- ;;
- 3)
- echo "Exiting..."
- exit 0
- ;;
- *)
- echo "Invalid choice. Please enter a number between 1 and 3."
- ;;
- esac
- done
- EOF
- chmod +x /root/install_ceph
- cat>/root/dashboard_ceph<<'EOF'
- #!/bin/bash
- sudo microceph.ceph mgr module enable dashboard
- sleep 5
- sudo microceph.ceph config set mgr mgr/dashboard/ssl false
- sudo echo -n '$PASSWORDROOT' > /var/snap/microceph/current/conf/password.txt
- sudo microceph.ceph dashboard ac-user-create -i /etc/ceph/password.txt admin administrator
- EOF
- chmod +x /root/dashboard_ceph
- cat>/root/add_ceph_disks<<'EOF'
- #!/bin/bash
- DK=$(lsblk -l -d -e 11 -n -o NAME)
- COUNT=0
- for i in $DK
- do
- blkid "/dev/$i" &> /dev/null
- if [ $? != 0 ]; then
- microceph disk add /dev/"$i"
- (( COUNT++ ))
- fi
- EOF
- chmod +x /root/add_ceph_disks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement