How to automate initial server configuration? I’m trying to add new nodes (Linux servers) to my cluster but I have to first configure my nodes properly, i.e. setting up the firewall, closing ports, disabling password login, setting up git,  etc…
This is all very time consuming and can go wrong easily due to human mistakes. How do I automate this process ideally? What tools are used for this? I read about Terraform, Ansible,  but I feel kinda lost with all those different technologies. My desired result would be whenever I buy a new VPS, I run a script (or connect it to a master node) and then configuration happens based on a template or so
Thanks in advance
What you are trying to accomplish is referred to as infrastructure as code.
Which tools you select will depend on where you are operating, and what your business needs are.  If you are operating in AWS exclusively, you can skip 3rd party solutions and focus on their CloudFormation service.  Terraform (infrastructure) and Ansible (configuration) are popular cloud agnostic tools if you are operating On-Prem or across multiple cloud providers.