25 lines
588 B
Bash
25 lines
588 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
PASS="mediabox"
|
||
|
HOSTNAME="mediabox"
|
||
|
|
||
|
# get the directory of the script
|
||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||
|
|
||
|
echo "Enter the ip address of the server:"
|
||
|
read ip
|
||
|
|
||
|
# if ip is not empty
|
||
|
if [ ! -z "$ip" ]; then
|
||
|
# write the ip to the inventory file
|
||
|
echo "$ip" > "$DIR/inventory"
|
||
|
fi
|
||
|
|
||
|
echo "run 'passwd' on the archiso and chage the root password to something"
|
||
|
|
||
|
ansible-playbook -v -i "inventory" playbook.yml --ask-pass --user root \
|
||
|
--extra-vars user_password="$(openssl passwd -crypt $PASS)" \
|
||
|
--extra-vars hostname="$HOSTNAME"
|