Easy network apt
Quick and dirty way to update any server on your network that uses apt package management.
1. Verify you have ssh key access (passwordless to make this easy)
2. Add to each server you wish to update (security on lan only of course):
"sudo visudo -f /etc/sudoers"
# This allows any user in the admin group to
# run the apt-automate script without sudoing
%admin ALL= NOPASSWD: /usr/bin/apt-automate
3. Create a file called apt-automate by issuing the command:
"sudo nano /usr/bin/apt-automate"
# You may put any other custom flags in apt-get
# here as well
apt-get update && apt-get dist-upgrade
4. Issue the command to make the script executable
"sudo chmod +x /usr/bin/apt-automate"
5. On the machine you wish to manage the updates from create a file called update_all.sh
# you do not put the local hostname or ip here,
# since the command gets run locally below
hosts="machine1 machine2 machine3"
for i in $hosts;
- echo updating $i please wait....; ssh $i sudo apt-automate; done;
# comment the below line out if you wish to remove
# the local machine from updating
6. To use, run update_all.sh as a user in the admin group locally.