![]() Gather_facts: We are not using any gather facts in this playbook so disabling it. Hosts: lists of hosts or host group against which we want to run the task.īecome: Instructs the remote host to execute the playbook as admin. Replace your new user with their password in variable username and userpass of playbook. We have used 2 modules for this user and authorized. The play has 2 tasks: Create user and Deploy SSH Public Key. In this Playbook it contains a single play. We should be more cautions with the spaces while writing ansible playbook. ![]() Srv-02 | SUCCESS => Īll servers are reachable through ansible admin user. To run the playbook we are using an ansible admin user “ansible_admin”. I have also defined common variables for both groups. To give admin privileges to a normal user, in Ubuntu users should be in sudo group and in CentOS users should be in wheel group, so I’ve defined variable super_group for this. Here I have defined 2 groups CentOS and Ubuntu for our all hosts. This is an inventory file for our playbook. The key fingerprint is : SHA256:+Z/N055jsnrr2s/k7zg3IWA6SaURTmETeWFqC803vhM The key's randomart image is : +-+ | =+o. ![]() Your public key has been saved in /home/newuser/.ssh/id_rsa.pub. Enter passphrase (empty for no passphrase) : Enter same passphrase again : Your identification has been saved in /home/newuser/.ssh/id_rsa. Enter file in which to save the key (/home/newuser/.ssh/id_rsa) : Created directory '/home/newuser/.ssh'. $ ssh-keygen Generating public/private rsa key pair.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |