From 870298bf54c84bb7ebc235664432bc1b697e2519 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Wed, 28 Feb 2018 16:09:04 +0000 Subject: [PATCH] Add known hosts for all users The role today only adds known hosts for the zuul user. This replicates what d-g does today by adding a default known_hosts file which applies to all users. We csnnot remove the original task that adds for the zuul user since there's a unit test in openstack-zuul-jons that expects that. Depends-on: https://review.openstack.org/550425/ Change-Id: I54d4d975fa54cbb6df7dbed525211ab5c2cd6754 --- roles/multi-node-known-hosts/tasks/main.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/multi-node-known-hosts/tasks/main.yaml b/roles/multi-node-known-hosts/tasks/main.yaml index 30fdcf0f7..1c5e73e45 100644 --- a/roles/multi-node-known-hosts/tasks/main.yaml +++ b/roles/multi-node-known-hosts/tasks/main.yaml @@ -2,8 +2,16 @@ generate_all_known_hosts: hostvars: "{{ hostvars }}" -- name: add known_host record for every public key of every other ip, hostname +- name: add known_host record for every public key of every other ip, hostname for ansible_user known_hosts: name: "{{ item.name }}" key: "{{ item.key }}" with_items: "{{ all_known_hosts }}" + +- name: add default known_host record for every user + become: true + known_hosts: + name: "{{ item.name }}" + key: "{{ item.key }}" + path: /etc/ssh/ssh_known_hosts + with_items: "{{ all_known_hosts }}"