Fix bootstrap-host authorized_key transfer for multi-nodes

This ensures the lookup has something to lookup and doesn't assume
that the operation will run as in the root folder by default. This
assumption was fine for an AIO, but the process has to be done
differently for multi nodes.

Change-Id: Ia4121ebe8b4d64fd81ce779330d659bb954e4079
Signed-off-by: Jean-Philippe Evrard <jean-philippe@evrard.me>
This commit is contained in:
Jean-Philippe Evrard 2016-09-09 01:09:29 +01:00 committed by Kevin Carter (cloudnull)
parent 51f4dec329
commit f904d75fa8

View File

@ -57,11 +57,19 @@
tags:
- ssh-key-generate
- name: Ensure root's new public ssh key is in authorized_keys
authorized_key:
user: root
key: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}"
manage_dir: no
- name: Fetch the generated public ssh key
fetch:
src: "/root/.ssh/id_rsa.pub"
dest: "/tmp/id_rsa.pub"
flat: yes
when: inventory_hostname == groups['all'][0]
tags:
- ssh-key-authorized
- name: Ensure root's new public ssh key is in authorized_keys
authorized_key:
user: root
key: "{{ lookup('file','/tmp/id_rsa.pub') }}"
manage_dir: no
tags:
- ssh-key-authorized