shell 模块分发密钥
---
- name: configure ssh connection
hosts: nodes
gather_facts: false
connection: local
tasks:
- name: configure ssh connection
shell: |
ssh-keyscan {{inventory_hostname}} >>~/.ssh/known_hosts
sshpass -p'Thtf#997' ssh-copy-id root@{{inventory_hostname}}