Tutorial Highlights & Transcript
00:00 - Beginning of Video
00:12 - Scope of Demo
01:47 - Ansible Flow Chart
02:37 - Prerequisites
03:17 - Inventory Files
04:12 - Users.yml
04:31 - Ansible Playbook
05:31 - Demo
Okay, as you can see, the Ansible playbook is executed successfully, it has performed all the tasks, it has created the user on the remote host, and also set up the authorized keys and also removed the user from the remote force. Now, to check or to confirm whether these users are created successfully on all the servers or not for that. First I’m going to SSH into the bastion host using the new user. For example, I’m taking any new user. Let’s take this user Ray.
Okay, so I successfully logged in into the bastion using this user Ray, it means this user is created inside the bastion. Let’s check the list of users now inside the bastion. Okay, so as you can see, all these users which are listed here, are now present inside the bastion. And these two users which were earlier present, they are now removed from here. So it means this task is successfully done here. And now let’s move to any private server. For example, I’m taking the dev server here. And if I SSH into this server. I’m going to SSH into this test server using the same username as I forwarded its public key into the bastion. So I’m using the same user Ray So I successfully logged into this dev server, as well. It means this user is also created inside this. Let’s check the list of users present inside this and as you can see all the users that I listed here are now present here. And these two users are removed from here. So that’s it. That’s how we can create multiple users on multiple servers in one go using the Ansible playbook. And yeah, that’s a small demo from my side.
Shivani Katoch
Senior DevOps Support Engineer
nClouds
Shivani has been a Senior DevOps Support Engineer at nClouds since 2020 and works with customers to build modern, well-architected infrastructure on AWS. She is an AWS Certified Solutions Architect - Associate.