From 1707d87b382602935378545e76c0a5f654474b13 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 3 Apr 2018 11:27:17 +0100 Subject: xci: kubespray: Use the common tasks to manage the SSH keys Drop the kubespray specific tasks for managing the SSH keys in favor of the common ones. Change-Id: Ib8e18fcc14c4c0126cae72740dbb33921a21af6b Signed-off-by: Markos Chandras --- .../kubespray/playbooks/configure-opnfvhost.yml | 23 ++-------------------- .../kubespray/playbooks/configure-targethosts.yml | 6 ++---- 2 files changed, 4 insertions(+), 25 deletions(-) (limited to 'xci/installer/kubespray') diff --git a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml index a4bdbf07..af3267ee 100644 --- a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml +++ b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml @@ -30,18 +30,6 @@ 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" @@ -78,12 +66,5 @@ 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" diff --git a/xci/installer/kubespray/playbooks/configure-targethosts.yml b/xci/installer/kubespray/playbooks/configure-targethosts.yml index d89cd334..4efe82fd 100644 --- a/xci/installer/kubespray/playbooks/configure-targethosts.yml +++ b/xci/installer/kubespray/playbooks/configure-targethosts.yml @@ -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] }}" -- cgit 1.2.3-korg