Last active
January 15, 2026 06:19
-
-
Save divideby0/38c1285aea5a24f33d14c003e782fed2 to your computer and use it in GitHub Desktop.
Ubuntu 24.04 Workstation Setup for Ansible Management
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Ubuntu 24.04 Workstation Setup for Ansible Management | |
| # https://github.com/trifork/SwitchDataCenter-all | |
| # Update packages and install dependencies | |
| sudo apt update && sudo apt install -y openssh-server python3 curl net-tools | |
| # Start and enable SSH service | |
| sudo systemctl start ssh | |
| sudo systemctl enable ssh | |
| # Allow SSH through firewall (if UFW is active) | |
| sudo ufw allow ssh | |
| # Create .ssh directory and add authorized key | |
| mkdir -p ~/.ssh && chmod 700 ~/.ssh | |
| echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII8l7J7IvLdLrwVXwJZzeBOUqF0KqKjFlNVC6jwD2CP1" >> ~/.ssh/authorized_keys | |
| chmod 600 ~/.ssh/authorized_keys | |
| # Configure passwordless sudo for Ansible | |
| echo "$USER ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/$USER | |
| sudo chmod 440 /etc/sudoers.d/$USER | |
| # Verify setup | |
| echo "=== Setup Complete ===" | |
| echo "SSH status:" | |
| sudo systemctl status ssh --no-pager | head -5 | |
| echo -e "\nPython version:" | |
| python3 --version | |
| echo -e "\nPasswordless sudo:" | |
| sudo -n true && echo "OK" || echo "FAILED" | |
| echo -e "\nIP addresses:" | |
| ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment