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

@ -57,6 +57,8 @@ case $myCURRENT_DISTRIBUTION in
echo "### ... or press CTRL-C to manually install sudo and add your user to the sudoers." 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 "apt -y update && apt -y install sudo ${myPACKAGES}"
su -c "/usr/sbin/usermod -aG sudo $(whoami)" su -c "/usr/sbin/usermod -aG sudo $(whoami)"
# Refresh groups, so sudo is directly usable
newgrp sudo
else else
sudo apt update sudo apt update
sudo apt install -y ${myPACKAGES} sudo apt install -y ${myPACKAGES}
@ -71,17 +73,17 @@ case $myCURRENT_DISTRIBUTION in
esac esac
echo echo
# Check if passwordless sudo access is available # Check if sudo access is available
sudo -n true > /dev/null 2>&1 sudo -n true > /dev/null 2>&1
if [ $? -eq 1 ]; if [ $? -eq 1 ];
then 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" myANSIBLE_BECOME_OPTION="--ask-become-pass"
echo "### sudo is setup with password, setting ansible become option to ${myANSIBLE_BECOME_OPTION}." echo "### sudo is setup with password, setting ansible become option to ${myANSIBLE_BECOME_OPTION}."
echo echo
else
myANSIBLE_BECOME_OPTION="--become"
echo "### sudo is usable without password, setting ansible become option to ${myANSIBLE_BECOME_OPTION}."
echo
fi fi
# Download tpot.yml if not found locally # 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 "Done. Please reboot and re-connect via SSH on tcp/64295."
echo echo

View file

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

View file

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

View file

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

View file

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