diff --git a/playbooks/create_user_ssh/main2.yml b/playbooks/create_user_ssh/main2.yml new file mode 100644 index 0000000..398d853 --- /dev/null +++ b/playbooks/create_user_ssh/main2.yml @@ -0,0 +1,14 @@ +--- +- hosts: webservers #modify your server list + remote_user: root + + tasks: + - include_vars: users.yml + - name: Creating users to Jump Server + user: name="{{ item.username}}" + with_items: "{{ users }}" + + - name: Placing SSH Key to Authorized Key + #please note that this code assumes as if the public-private key pair is generated, all public users (created above) have public keys copied at one place i.e. keyfiles directory for the ease + authorized_key: user="{{item.username}}" key="{{ lookup('file', './keyfiles/authorized_keys.{{ item.username}}.pub')}}" + with_items: "{{ users }}" \ No newline at end of file