xci: kubespray: Use the common tasks to manage the SSH keys 93/54793/2
authorMarkos Chandras <mchandras@suse.de>
Tue, 3 Apr 2018 10:27:17 +0000 (11:27 +0100)
committerMarkos Chandras <mchandras@suse.de>
Fri, 6 Apr 2018 09:21:22 +0000 (10:21 +0100)
Drop the kubespray specific tasks for managing the SSH keys in favor of
the common ones.

Change-Id: Ib8e18fcc14c4c0126cae72740dbb33921a21af6b
Signed-off-by: Markos Chandras <mchandras@suse.de>
xci/installer/kubespray/playbooks/configure-opnfvhost.yml
xci/installer/kubespray/playbooks/configure-targethosts.yml

index a4bdbf0..af3267e 100644 (file)
         recursive: yes
         delete: yes
 
-    - name: generate SSH keys
-      command: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
-      args:
-        creates: /root/.ssh/id_rsa
-    - name: add id_rsa.pub to authorized_keys
-      shell: cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
-      when:  xci_flavor == 'aio'
-    - name: fetch public key
-      fetch:
-        src: "{{ ansible_env.HOME }}/.ssh/id_rsa.pub"
-        dest: "{{ xci_path }}/xci/files/authorized_keys"
-        flat: yes
     - name: delete the opnfv_inventory directory
       file:
         path: "{{ remote_xci_path }}/.cache/repos/kubespray/opnfv_inventory"
         name: ansible
         version: "{{ xci_kube_ansible_pip_version }}"
 
-
-- hosts: localhost
-  remote_user: root
-  vars_files:
-    - "{{ xci_path }}/xci/var/opnfv.yml"
-  tasks:
-    - name: Append public keys to authorized_keys
-      shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> {{ xci_path }}/xci/files/authorized_keys"
-      changed_when: True
+    - name: Manage SSH keys
+      include_tasks: "{{ xci_path }}/xci/playbooks/manage-ssh-keys.yml"
index d89cd33..4efe82f 100644 (file)
@@ -2,10 +2,8 @@
 - hosts: all
   remote_user: root
   tasks:
-    - name: add public key to host
-      copy:
-        src: "{{ xci_path }}/xci/files/authorized_keys"
-        dest: /root/.ssh/authorized_keys
+    - name: Manage SSH keys
+      include_tasks: "{{ xci_path }}/xci/playbooks/manage-ssh-keys.yml"
     - name: Install required packages
       package:
         name: "{{ kube_require_packages[ansible_pkg_mgr] }}"