blob: d80f6b9cbf9be464341bc3eba8e350341a135dd3 [file] [log] [blame]
# 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.
---
- hosts: 127.0.0.1
connection: local
tasks:
- name: Create user account for "{{ name }}"
os_user:
name: "{{ name }}"
email: "{{ email }}"
password: "{{ password }}"
auth:
auth_url: {{ endpoint }}
username: {{ admin_user }}
password: {{ admin_password }}
project_name: {{ admin_project }}
- name: Create project for "{{ project }}"
os_project:
name: "{{ project }}"
auth:
auth_url: {{ endpoint }}
username: {{ admin_user }}
password: {{ admin_password }}
project_name: {{ admin_project }}
{% for role in roles %}
- name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}"
keystone_user:
user: "{{ name }}"
role: "{{ role }}"
tenant: "{{ project }}"
endpoint: {{ endpoint }}
login_user: {{ admin_user }}
login_password: {{ admin_password }}
login_tenant_name: {{ admin_project }}
{% endfor %}
# FIXME: the below should work in Ansible 2.1, once we get the Admin/admin and
# Member/user role name issues straightened out.
#
# - name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}"
# os_user_role:
# user: "{{ name }}"
# role: "{{ role }}"
# project: "{{ project }}"
# auth:
# auth_url: {{ endpoint }}
# username: {{ admin_user }}
# password: {{ admin_password }}
# project_name: {{ admin_project }}