[testusero@test linux-server-modify]$ cat copy_ssh_file.yml
---
- name: copy ssh file
hosts: all
tasks:
- name: 1 | copy ssh file
authorized_key:
user: testuser
state: present
key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"

执行playbook命令

ansible-playbook copy_ssh_file.yml -k -K

版权声明:本文为博主原创文章,未经博主允许不得转载。

ansible