
playbook 을 활용해 호스트의 비밀번호를 local rsa 파일로 갖고있으며
매번 입력하지않아도 된다
---
- hosts: cxxnas
gather_facts: no
tasks:
- name: create key
connection: local
command: "ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ''"
run_once: true
- name: input key
authorized_key:
user: root
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"호스트를 지정하고
키를 만들고 (local)
해당 키에 대한 pub 키를 해당 호스트에 넣어둔다
이후는 접속이 가능해진다
댓글 남기기