Merge "Use MaaS node key when on_maas" into cord-1.0
diff --git a/roles/head-prep/tasks/main.yml b/roles/head-prep/tasks/main.yml
index 768390e..4b27b39 100644
--- a/roles/head-prep/tasks/main.yml
+++ b/roles/head-prep/tasks/main.yml
@@ -63,3 +63,9 @@
dest={{ ansible_user_dir }}/.ansible.cfg
owner={{ ansible_user_id }} mode=0644
+- name: Open permissions on MaaS node key
+ file:
+ src={{ maas_node_key }}
+ owner=root
+ mode=0444
+ when: on_maas
diff --git a/roles/onos-vm-install/files/onos-docker-compose.yml b/roles/onos-vm-install/files/onos-docker-compose.yml
index 09255fa..c57afcb 100644
--- a/roles/onos-vm-install/files/onos-docker-compose.yml
+++ b/roles/onos-vm-install/files/onos-docker-compose.yml
@@ -15,5 +15,4 @@
- "9876"
network_mode: host
volumes:
- - ./id_rsa:/root/node_key:ro
-
+ - ./node_key:/root/node_key:ro
diff --git a/roles/onos-vm-install/files/onos-setup-playbook.yml b/roles/onos-vm-install/files/onos-setup-playbook.yml
index 24f23d1..4ab44cb 100644
--- a/roles/onos-vm-install/files/onos-setup-playbook.yml
+++ b/roles/onos-vm-install/files/onos-setup-playbook.yml
@@ -21,14 +21,11 @@
remote_user: ubuntu
tasks:
- - name: Copy over SSH keys
+ - name: Copy over SSH key
copy:
- src=~/.ssh/{{ item }}
- dest={{ ansible_user_dir }}/cord/{{ item }}
+ src={{ node_private_key }}
+ dest={{ ansible_user_dir }}/cord/node_key
owner={{ ansible_user_id }} mode=0600
- with_items:
- - id_rsa
- - id_rsa.pub
- name: Copy over files to build XOS variant of ONOS
copy:
diff --git a/roles/onos-vm-install/templates/onos-setup-vars.yml.j2 b/roles/onos-vm-install/templates/onos-setup-vars.yml.j2
index cd21505..136e686 100644
--- a/roles/onos-vm-install/templates/onos-setup-vars.yml.j2
+++ b/roles/onos-vm-install/templates/onos-setup-vars.yml.j2
@@ -1,2 +1,6 @@
---
-
+{% if on_maas %}
+node_private_key: "{{ maas_node_key }}"
+{% else %}
+node_private_key: "~/.ssh/id_rsa"
+{% endif %}
diff --git a/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml b/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
index 8a99769..f2724cb 100644
--- a/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
+++ b/roles/xos-vm-install/files/xos-setup-cord-pod-playbook.yml
@@ -46,7 +46,7 @@
- name: copy over SSH key as node_key
copy:
- src=~/.ssh/id_rsa
+ src={{ node_private_key }}
dest={{ service_profile_repo_dest }}/{{ xos_configuration }}/node_key
- name: Download Glance VM images
@@ -76,4 +76,3 @@
chdir="{{ xos_repo_dest }}/containers/xos/"
with_items:
- base
-
diff --git a/roles/xos-vm-install/templates/xos-setup-vars.yml.j2 b/roles/xos-vm-install/templates/xos-setup-vars.yml.j2
index 9a0afbb..cb96393 100644
--- a/roles/xos-vm-install/templates/xos-setup-vars.yml.j2
+++ b/roles/xos-vm-install/templates/xos-setup-vars.yml.j2
@@ -14,3 +14,9 @@
service_profile_repo_url: "{{ service_profile_repo_url }}"
service_profile_repo_dest: "{{ service_profile_repo_dest }}"
service_profile_repo_branch: "{{ service_profile_repo_branch }}"
+
+{% if on_maas %}
+node_private_key: "{{ maas_node_key }}"
+{% else %}
+node_private_key: "~/.ssh/id_rsa"
+{% endif %}
diff --git a/vars/cord_defaults.yml b/vars/cord_defaults.yml
index 541569f..12ce207 100644
--- a/vars/cord_defaults.yml
+++ b/vars/cord_defaults.yml
@@ -4,6 +4,8 @@
# turn this off, or override when running playbook with --extra-vars="on_maas=False"
on_maas: True
+maas_node_key: /etc/maas/ansible/id_rsa
+
openstack_version: kilo
juju_config_name: cord