I manage a few Linux servers and want to run a specific set of updates each month without logging into each one separately. Could I do this from Windows using WSL, while keeping the run manual?
How would you use Ansible for monthly Linux server updates?
Answers
Yes. Install Ansible in WSL, set up SSH key access to the servers, and put the hosts in an inventory file. Then create a playbook for the update steps you actually need. A Windows batch file can launch the playbook from WSL, so you can still start it by hand after the other work is done.
Use a passphrase on the private key rather than putting credentials in the batch file. SSH authentication and sudo authorization are separate things, though. Check how privilege escalation is configured on the servers instead of assuming the SSH key removes the need for a sudo password.
Reply to this answer
For the first run, keep the blast radius small. Target a test server, review the exact package tasks, and configure the play to process one host at a time. Add a confirmation prompt before updates and check the final status for failures.
Make sure the playbook matches the update commands and maintenance process you were given. In particular, don't assume package installation alone covers reboots or application checks.
Reply to this answer
WSL is a reasonable starting point, but it doesn't have to be the permanent control machine. A Linux VM is another option if the playbooks need a shared home or shouldn't depend on one workstation. Pick whichever fits how the team accesses and maintains it.
Rilquaro.4v:
If multiple technicians need the playbooks, keeping them in Git can help them work from the same version.
Reply to this answer
This is a nice first Ansible job because the steps are repetitive and you can see whether they worked. Once that's solid, it may be useful for other Linux administration tasks too. Just don't feel obliged to turn every little command into a playbook.
Reply to this answer
Add your answer
Answers are reviewed before publication.
5y+canvasratchet_738:
Keeping the run manual is what I need. A launcher sounds handy once the playbook is tested.