tweak installer, playbooks

This commit is contained in:
Marco Ochse 2023-06-30 13:15:30 +02:00
parent e4b73c5be7
commit 2d1a06551c
5 changed files with 17 additions and 9 deletions

View file

@ -53,10 +53,12 @@ case $myCURRENT_DISTRIBUTION in
"Debian GNU/Linux"|"Ubuntu")
if ! command -v sudo >/dev/null;
then
echo "### sudo is not installed. To continue you need to provide the root password ... "
echo "### ... or press CTRL-C to manually install sudo and add your user to the sudoers."
su -c "apt -y update && apt -y install sudo ${myPACKAGES}"
echo "### sudo is not installed. To continue you need to provide the root password ... "
echo "### ... or press CTRL-C to manually install sudo and add your user to the sudoers."
su -c "apt -y update && apt -y install sudo ${myPACKAGES}"
su -c "/usr/sbin/usermod -aG sudo $(whoami)"
# Refresh groups, so sudo is directly usable
newgrp sudo
else
sudo apt update
sudo apt install -y ${myPACKAGES}
@ -71,17 +73,17 @@ case $myCURRENT_DISTRIBUTION in
esac
echo
# Check if passwordless sudo access is available
# Check if sudo access is available
sudo -n true > /dev/null 2>&1
if [ $? -eq 1 ];
then
myANSIBLE_BECOME_OPTION="--become"
echo "### sudo is setup passwordless, setting ansible become option to ${myANSIBLE_BECOME_OPTION}."
echo
else
myANSIBLE_BECOME_OPTION="--ask-become-pass"
echo "### sudo is setup with password, setting ansible become option to ${myANSIBLE_BECOME_OPTION}."
echo
else
myANSIBLE_BECOME_OPTION="--become"
echo "### sudo is usable without password, setting ansible become option to ${myANSIBLE_BECOME_OPTION}."
echo
fi
# Download tpot.yml if not found locally
@ -115,4 +117,3 @@ echo "SMTP, HTTP, etc. might prevent T-Pot from starting."
echo "Done. Please reboot and re-connect via SSH on tcp/64295."
echo

View file

@ -3,6 +3,7 @@
- name: On Debian, check if sudo is installed
hosts: all
gather_facts: true
become: false
pre_tasks:
- name: Check for non-root user id

View file

@ -6,6 +6,8 @@
- name: T-Pot Abort if run as root
hosts: all
gather_facts: true
become: false
pre_tasks:
- name: Check if running as root
assert:
@ -312,6 +314,7 @@
- name: T-Pot - Adjust group users, bashrc, clone / update T-Pot repository
hosts: all
gather_facts: true
become: false
tasks:
- name: Add aliases (All)

View file

@ -3,6 +3,7 @@
- name: On Debian, remove sudo
hosts: all
gather_facts: true
become: false
pre_tasks:
- name: Check for non-root user id

View file

@ -6,6 +6,7 @@
- name: T-Pot Abort if run as root
hosts: all
gather_facts: true
become: false
pre_tasks:
- name: Check if running as root
@ -27,6 +28,7 @@
- name: T-Pot - Remove group users, bashrc
hosts: all
gather_facts: true
become: false
tasks:
- name: Remove aliases (All)