{#
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_humanname }}"
    abbreviated_name: "{{ site_name }}"
    login_base: "{{ 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_humanname }}"
      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_humanname }}"
      model: core.Site

{% endfor %}

