Fix: Username detection
This commit is contained in:
parent
0fb7823c23
commit
8d19e1f5ed
3 changed files with 10 additions and 5 deletions
|
@ -26,7 +26,7 @@
|
|||
# line: "PasswordAuthentication no"
|
||||
# register: sshd_config
|
||||
|
||||
- name: Enable passwordless sudo for user
|
||||
- name: "Enable passwordless sudo for {{ username }}"
|
||||
lineinfile:
|
||||
dest: /etc/sudoers
|
||||
regexp: "^%wheel"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
|
||||
ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
|
||||
USERNAME="$(id -nu 1000)"
|
||||
|
||||
echo
|
||||
echo "======================================"
|
||||
|
@ -24,7 +25,7 @@ fi
|
|||
|
||||
|
||||
|
||||
ansible-playbook ansible/setup.yml -i ansible/hosts -K -e username="$USER"
|
||||
ansible-playbook ansible/setup.yml -i ansible/hosts -K -e username="$USERNAME"
|
||||
|
||||
# echo "Configuring permissions..."
|
||||
# echo
|
||||
|
|
|
@ -13,6 +13,7 @@ STATE_FOLDER="${ROOT_FOLDER}/state"
|
|||
SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
|
||||
INTERNAL_IP="$(hostname -I | awk '{print $1}')"
|
||||
DNS_IP=9.9.9.9 # Default to Quad9 DNS
|
||||
USERNAME="$(id -nu 1000)"
|
||||
|
||||
if [[ $UID != 0 ]]; then
|
||||
echo "Tipi must be started as root"
|
||||
|
@ -65,14 +66,17 @@ TZ="$(cat /etc/timezone | sed 's/\//\\\//g' || echo "Europe/Berlin")"
|
|||
|
||||
# Copy the app state if it isn't here
|
||||
if [[ ! -f "${STATE_FOLDER}/apps.json" ]]; then
|
||||
cp "${ROOT_FOLDER}/templates/apps-sample.json" "${STATE_FOLDER}/apps.json" && chown -R "1000:1000" "${STATE_FOLDER}/apps.json"
|
||||
cp "${ROOT_FOLDER}/templates/apps-sample.json" "${STATE_FOLDER}/apps.json"
|
||||
fi
|
||||
|
||||
# Copy the user state if it isn't here
|
||||
if [[ ! -f "${STATE_FOLDER}/users.json" ]]; then
|
||||
cp "${ROOT_FOLDER}/templates/users-sample.json" "${STATE_FOLDER}/users.json" && chown -R "1000:1000" "${STATE_FOLDER}/users.json"
|
||||
cp "${ROOT_FOLDER}/templates/users-sample.json" "${STATE_FOLDER}/users.json"
|
||||
fi
|
||||
|
||||
chown -R 1000:1000 "${STATE_FOLDER}/apps.json"
|
||||
chown -R 1000:1000 "${STATE_FOLDER}/users.json"
|
||||
|
||||
# Create seed file with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
|
||||
if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
|
||||
echo "Generating seed..."
|
||||
|
@ -114,7 +118,7 @@ done
|
|||
mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
|
||||
mv -f "$ENV_FILE_SYSTEM_API" "$ROOT_FOLDER/packages/system-api/.env"
|
||||
|
||||
ansible-playbook ansible/start.yml -i ansible/hosts -K -e username="$USER"
|
||||
ansible-playbook ansible/start.yml -i ansible/hosts -K -e username="$USERNAME"
|
||||
|
||||
# Run docker-compose
|
||||
docker-compose --env-file "${ROOT_FOLDER}/.env" up --detach --remove-orphans --build || {
|
||||
|
|
Loading…
Add table
Reference in a new issue