]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
tools: Script to simplify Cobbler user creation 331/head
authorDavid Galloway <dgallowa@redhat.com>
Fri, 1 Sep 2017 19:18:29 +0000 (15:18 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Fri, 1 Sep 2017 19:24:59 +0000 (15:24 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
tools/cobbler-access.sh [new file with mode: 0755]

diff --git a/tools/cobbler-access.sh b/tools/cobbler-access.sh
new file mode 100755 (executable)
index 0000000..1dca738
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+# Script to generate Cobbler credentials
+
+tmpfile=$(mktemp)
+
+# Basically `mkpasswd` but uses a small subset of special characters
+password=$(head /dev/urandom | tr -dc 'A-Za-z0-9!@#$%&' | head -c 12 && echo)
+
+if [ $# -eq 0 ]; then
+  printf "Enter username: "
+  read -r username
+else
+  username=$1
+fi
+
+cat << EOF
+
+------ String for cobbler.yml ------
+$(echo -n "$username:Cobbler:" && echo -n "$username:Cobbler:$password" | md5sum | awk '{ print $1 }')
+
+------ E-mail to $username ------
+Hi FIRSTNAME,
+
+Here are your Cobbler user credentials.
+
+Username: $username
+Password: $password
+
+Please do not share these credentials.
+
+Thank you.
+
+EOF