Browse Source

ssh known hosts

master
parent
commit
bbc94ce76d
1 changed files with 13 additions and 15 deletions
  1. +13
    -15
      users.yaml

+ 13
- 15
users.yaml View File

@@ -8,19 +8,19 @@
roles:
- name: users

# - hosts: desktops:laptops
# remote_user: root
# tasks:
# - name: /etc/ssh/ssh_config
# template:
# src: ssh_config.j2
# dest: /etc/ssh/ssh_config
# - name: ssh known hosts
# known_hosts:
# name: "{{item}}"
# key: "{{item}},{{hostvars[item].ansible_default_ipv4.address}} {{hostvars[item].ansible_ssh_host_key_ed25519_public_keytype}} {{hostvars[item].ansible_ssh_host_key_ed25519_public}}"
# path: /etc/ssh/ssh_known_hosts
# loop: "{{groups.servers}}"
- hosts: desktops:laptops
remote_user: root
tasks:
- name: /etc/ssh/ssh_config
template:
src: ssh_config.j2
dest: /etc/ssh/ssh_config
- name: ssh known hosts
known_hosts:
name: "{{item}}"
key: "{{item}},{{hostvars[item].ansible_all_ipv4_addresses|join(',')}},{{hostvars[item].ansible_all_ipv6_addresses|join(',')}} {{hostvars[item].ansible_ssh_host_key_ed25519_public_keytype}} {{hostvars[item].ansible_ssh_host_key_ed25519_public}}"
path: /etc/ssh/ssh_known_hosts
loop: "{{groups.servers}}"

- hosts:
- servers
@@ -34,5 +34,3 @@
loop: "{{ hostvars | json_query(\"*.user_ssh_keys_info.results[]\") }}"
loop_control:
label: "{{ item.name }}"
tags:
- users