[CORD-1556] Generating inital data and mounting on xos-core

Change-Id: Icdd1a596083f385b7af831aef0ce3f23ef732542
diff --git a/roles/cord-profile/tasks/main.yml b/roles/cord-profile/tasks/main.yml
index 6c49108..a3c38ab 100644
--- a/roles/cord-profile/tasks/main.yml
+++ b/roles/cord-profile/tasks/main.yml
@@ -103,6 +103,7 @@
   with_items:
     - xos_config.yaml
     - xos_config_synchronizer.yaml
+    - initial_data.yaml
     - deployment.yaml
     - xos.yaml
     - gateway-config.yml
@@ -126,7 +127,6 @@
   with_items: "{{ xos_other_templates }}"
 
 - name: Create OpenStack config and TOSCA onboarding
-  when: use_openstack
   template:
     src: "{{ item }}.j2"
     dest: "{{ config_cord_profile_dir }}/{{ item }}"
diff --git a/roles/cord-profile/templates/deployment.yaml.j2 b/roles/cord-profile/templates/deployment.yaml.j2
index 1c7a41b..71f1355 100644
--- a/roles/cord-profile/templates/deployment.yaml.j2
+++ b/roles/cord-profile/templates/deployment.yaml.j2
@@ -45,18 +45,6 @@
 
 {% endfor %}
 
-# Site
-    {{ site_name }}:
-      type: tosca.nodes.Site
-      properties:
-        display_name: {{ site_humanname }}
-        site_url: http://{{ site_name }}.opencloud.us/
-        hosts_nodes: true
-      requirements:
-        - deployment:
-            node: {{ deployment_type }}
-            relationship: tosca.relationships.MemberOfDeployment
-
 # Attach the Tenant view to the deployment
     Tenant:
       type: tosca.nodes.DashboardView
@@ -67,40 +55,3 @@
         - deployment:
             node: {{ deployment_type }}
             relationship: tosca.relationships.SupportsDeployment
-
-# XOS Users
-# Default admin user account
-    {{ xos_admin_user }}:
-      type: tosca.nodes.User
-      properties:
-        password: {{ xos_admin_pass }}
-        firstname: {{ xos_admin_first }}
-        lastname: {{ xos_admin_last }}
-        is_admin: True
-      requirements:
-        - site:
-            node: {{ site_name }}
-            relationship: tosca.relationships.MemberOfSite
-        - tenant_dashboard:
-            node: Tenant
-            relationship: tosca.relationships.UsesDashboard
-
-# All other users
-{% for user in xos_users %}
-    {{ user.email }}:
-      type: tosca.nodes.User
-      properties:
-        password: {{ user.password }}
-        firstname: {{ user.first | default(user.email) }}
-        lastname: {{ user.last | default("unknown") }}
-        is_admin: {{ user.admin | default("false") }}
-      requirements:
-        - site:
-            node: {{ site_name }}
-            relationship: tosca.relationships.MemberOfSite
-        - tenant_dashboard:
-            node: Tenant
-            relationship: tosca.relationships.UsesDashboard
-
-{% endfor %}
-
diff --git a/roles/cord-profile/templates/docker-compose.yml.j2 b/roles/cord-profile/templates/docker-compose.yml.j2
index 6ff8914..b3faeaf 100644
--- a/roles/cord-profile/templates/docker-compose.yml.j2
+++ b/roles/cord-profile/templates/docker-compose.yml.j2
@@ -231,7 +231,7 @@
 {% for network in xos_docker_networks %}
      - {{ network }}
 {% endfor %}
-    command: python /opt/xos/manage.py runserver 0.0.0.0:9000 --insecure --makemigrations
+    command: python /opt/xos/manage.py runserver 0.0.0.0:9000 --insecure
     ports:
       - "9000:9000"
     links:
@@ -288,6 +288,7 @@
       - {{ head_cord_profile_dir }}:/opt/cord_profile:ro
       - {{ head_cord_dir }}/orchestration/xos_libraries/ng-xos-lib:/opt/xos_libraries/ng-xos-lib:ro
       - {{ head_cord_profile_dir }}/im_cert_chain.pem:/usr/local/share/ca-certificates/local_certs.crt:ro
+      - {{ head_cord_profile_dir }}/initial_data.yaml:/opt/xos/core/migrations/initial_data.yaml:ro
       - /var/run/docker.sock:/var/run/docker.sock
     logging:
       driver: "json-file"
diff --git a/roles/cord-profile/templates/initial_data.yaml.j2 b/roles/cord-profile/templates/initial_data.yaml.j2
new file mode 100644
index 0000000..4433c2b
--- /dev/null
+++ b/roles/cord-profile/templates/initial_data.yaml.j2
@@ -0,0 +1,52 @@
+{#
+Copyright 2017-present Open Networking Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+#}
+
+# Site
+- model: core.Site
+  fields:
+    name: {{ site_name }}
+    site_url: http://{{ site_name }}.opencloud.us/
+    hosts_nodes: true
+
+# User
+- model: core.User
+  fields:
+    email: {{ xos_admin_user }}
+    password: {{ xos_admin_pass }}
+    firstname: {{ xos_admin_first }}
+    lastname: {{ xos_admin_last }}
+    is_admin: True
+  relations:
+    site:
+      fields:
+        name: {{ site_name }}
+      model: core.Site
+
+# All other users
+{% for user in xos_users %}
+- model: core.User
+  fields:
+    email: {{ user.email }}
+    password: {{ user.password }}
+    firstname: {{ user.first | default(user.email) }}
+    lastname: {{ user.last | default("unknown")  }}
+    is_admin: {{ user.admin | default("false") }}
+  relations:
+    site:
+      fields:
+        name: {{ site_name }}
+      model: core.Site
+{% endfor %}
\ No newline at end of file