当我的/etc/ssh/sshd_config将AuthorizedKeysFile设置为/etc/ssh/authorized_keys/%u时,如何让 Ansible 填充正确的文件?Ansible 似乎忽略了设置并将密钥放在$HOME/.ssh/authorized_keys
剧本:
---
- hosts: all
vars:
vars_files:
- ../group_vars/ssh_root_authorized_keys.yml
gather_facts: false
tasks:
- name: Set up multiple authorized keys
authorized_key:
user: root
state: present
key: '{{ item.key }}'
with_items: "{{ root_auth_keys }}"
ssh_root_authorized_keys.yml
root_auth_keys:
- name: backup@host
key : "{{ lookup('file', '../group_vars/pubkeys/[email protected]') }}"
- name: nagios@host
key : "{{ lookup('file', '../group_vars/pubkeys/[email protected]') }}"