Simple ansible configuration of base systems accorss different environments.
✅ In this example we are going to create a user for DevOps engineers. this dedicated user will have root access to our server.
- inventory
Try this command to add your users key to the server so you can connect to it using your workstation.
ansible all -k -K -m authorized_key -a "user='your_username' state='present' key='{{lookup('file', '~/.ssh/id_rsa.pub')}}'"
To run a particular configuration:
ansible-playbook ansible-learning.yml
This playbook will create a user called "devops" in your server and makes it a sudo user.