exam 6
A new developer called "John Doe"
is recently hired in your team. He needs to get inside all the remote servers via ssh
as root
user.
Write a playbook /home/thor/playbooks/give_ssh_access.yml
to give ssh access on all the remote servers by pushing his public key: /home/thor/playbooks/john_doe.pub
on all of them.
List of all servers is listed in the inventory /home/thor/playbooks/inventory
Create give_ssh_access.yml
playbook and add below given code
---
- hosts: all
gather_facts: no
tasks:
- authorized_key:
user: root
key: "{{ lookup('file', 'john_doe.pub') }}"
state: present
Comments
Post a Comment