1 # Copyright (c) 2018 Intel Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 name: "{{ hostvars[ansible_host].ansible_user }}"
20 ssh_key_file: "/root/.ssh/id_rsa"
22 - name: Get remote files
24 src: "/root/.ssh/id_rsa.pub"
27 - name: Update authorized_key
29 key: "{{ lookup('file', '/tmp/{{ hostvars[item].ansible_host }}/root/.ssh/id_rsa.pub') }}"
31 user: "{{ hostvars[item].ansible_user }}"
33 - "{{ groups['ostack'] }}"
34 - "{{ groups['yardstickG'] }}"
36 - name: Make sure the known hosts file exists
38 path: "{{ ssh_known_hosts_file }}"
41 - name: Add key to known hosts
43 name: "{{ hostvars[item].ansible_host }}"
44 key: "{{ lookup('pipe', 'ssh-keyscan -t rsa {{ hostvars[item].ansible_host }}') }}"
45 path: "{{ ssh_known_hosts_file }}"
47 - "{{ groups['ostack'] }}"
48 - "{{ groups['yardstickG'] }}"