#!/bin/bash # Bailey Allison # Matthew Hutchinson #v7 OS=$(cat /etc/os-release | grep -w NAME) if [ "$OS" == 'NAME="Rocky Linux"' ] ; then dnf install ceph-mon elif [ "$OS" == 'NAME="Ubuntu"' ]; then apt install ceph-mon else echo "OS is not Ubuntu or Rocky Linux" exit fi # Check for ceph.conf and admin keyring if [[ ! -f "/etc/ceph/ceph.conf" || ! -f "/etc/ceph/ceph.client.admin.keyring" ]]; then echo "ceph conf and admin keyring not on host, exiting" exit 1 fi # Create Keyring Directory and make Keyring echo "Creating Keyring" mkdir /var/lib/ceph/mon/ceph-$(hostname -s) ceph auth get mon. -o /tmp/key-$(hostname -s) ceph mon getmap -o /tmp/map-$(hostname -s) ceph-mon -i $(hostname -s) --mkfs --monmap /tmp/map-$(hostname -s) --keyring /tmp/key-$(hostname -s) chown -R ceph:ceph /var/lib/ceph/mon/ceph-$(hostname -s) # Open Firewall ports echo "Opening Firewall" firewall-cmd --add-service={ceph,ceph-mon} --permanent firewall-cmd --reload # Start MON Service echo "Starting MON service" systemctl enable --now ceph-mon@$(hostname -s) ceph -s echo -e "\e[1;31mmon-$(hostname -s)\e[0m has been \e[1;32madded\e[0m"