Ansible批量配置SSH公钥

Ansible 批量配置 ssh 公钥

---
- hosts: k8s
  remote_user: root

  tasks:
  - name: Set authorized key taken from file
    authorized_key:
      user: root
      state: present
      key: "{{ lookup('file', item) }}"
    with_items:
    - "/root/.ssh/id_rsa.pub"
    - "/root/id_rsa.pub"

image

posted @ 2022-11-20 11:56  liy36  阅读(36)  评论(0)    收藏  举报