prototypes: xci: Move host keys away from / directory 05/34605/2
authorMarkos Chandras <mchandras@suse.de>
Wed, 10 May 2017 10:37:38 +0000 (11:37 +0100)
committerMarkos Chandras <mchandras@suse.de>
Thu, 11 May 2017 22:42:12 +0000 (23:42 +0100)
Putting the host keys in '/' requires root privileges so
it's best if we place them in the same directory like the
rest of the XCI files.

Change-Id: I030ed3d6cbb57bb984a78aeffb4eca2bd5c10bb0
Signed-off-by: Markos Chandras <mchandras@suse.de>
prototypes/xci/config/user-vars
prototypes/xci/playbooks/configure-opnfvhost.yml
prototypes/xci/playbooks/roles/remove-folders/tasks/main.yml
prototypes/xci/var/opnfv.yml

index 135db71..f9de940 100755 (executable)
@@ -32,6 +32,7 @@ export XCI_DEVEL_ROOT=${XCI_DEVEL_ROOT:-"/tmp/.xci-deploy-env"}
 export OPNFV_RELENG_PATH="${XCI_DEVEL_ROOT}/releng"
 export OPENSTACK_BIFROST_PATH="${XCI_DEVEL_ROOT}/bifrost"
 export OPENSTACK_OSA_PATH="${XCI_DEVEL_ROOT}/openstack-ansible"
+export OPNFV_SSH_HOST_KEYS_PATH="${XCI_DEVEL_ROOT}/ssh_host_keys"
 
 #-------------------------------------------------------------------------------
 # Set the playbook to use for OpenStack deployment
index 28e6b21..af90c9d 100644 (file)
       shell: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
       args:
         creates: /root/.ssh/id_rsa
+    - name: ensure ssh key storage directory exists
+      file:
+        path: "{{ OPNFV_SSH_HOST_KEYS_PATH }}"
+        state: directory
     - name: fetch public key
-      fetch: src="/root/.ssh/id_rsa.pub" dest="/"
+      fetch: src="/root/.ssh/id_rsa.pub" dest="{{ OPNFV_SSH_HOST_KEYS_PATH }}"
     - name: copy flavor inventory
       shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/inventory {{OPNFV_RELENG_PATH}}/prototypes/xci/playbooks"
     - name: copy flavor vars
         chdir: "{{OPENSTACK_OSA_PATH}}/scripts"
 - hosts: localhost
   remote_user: root
+  vars_files:
+    - ../var/opnfv.yml
   tasks:
     - name: Generate authorized_keys
-      shell: "/bin/cat /opnfv/root/.ssh/id_rsa.pub >> ../file/authorized_keys"
+      shell: "/bin/cat {{ OPNFV_SSH_HOST_KEYS_PATH }}/opnfv/root/.ssh/id_rsa.pub >> ../file/authorized_keys"
     - name: Append public keys to authorized_keys
       shell: "/bin/cat /root/.ssh/id_rsa.pub >> ../file/authorized_keys"
index ac8c0f7..425b8db 100644 (file)
@@ -18,3 +18,4 @@
     - "{{ OPENSTACK_OSA_PATH }}"
     - "{{ OPENSTACK_OSA_ETC_PATH }}"
     - "{{ LOG_PATH }} "
+    - "{{ OPNFV_SSH_HOST_KEYS_PATH }}"
index aa84d7b..85f532a 100644 (file)
@@ -26,3 +26,4 @@ XCI_FLAVOR_ANSIBLE_FILE_PATH: "{{ lookup('env','XCI_FLAVOR_ANSIBLE_FILE_PATH') }
 XCI_LOOP: "{{ lookup('env','XCI_LOOP') }}"
 LOG_PATH: "{{ lookup('env','LOG_PATH') }}"
 OPNFV_HOST_IP: "{{ lookup('env','OPNFV_HOST_IP') }}"
+OPNFV_SSH_HOST_KEYS_PATH: "{{ lookup('env', 'OPNFV_SSH_HOST_KEYS_PATH') }}"