Matteo Scandolo | f044103 | 2017-08-08 13:05:26 -0700 | [diff] [blame^] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 17 | --- |
| 18 | - hosts: 127.0.0.1 |
| 19 | connection: local |
| 20 | tasks: |
| 21 | |
| 22 | - name: Create user account for "{{ name }}" |
| 23 | os_user: |
| 24 | name: "{{ name }}" |
| 25 | email: "{{ email }}" |
| 26 | password: "{{ password }}" |
| 27 | auth: |
| 28 | auth_url: {{ endpoint }} |
| 29 | username: {{ admin_user }} |
| 30 | password: {{ admin_password }} |
| 31 | project_name: {{ admin_project }} |
| 32 | |
| 33 | - name: Create project for "{{ project }}" |
| 34 | os_project: |
| 35 | name: "{{ project }}" |
| 36 | auth: |
| 37 | auth_url: {{ endpoint }} |
| 38 | username: {{ admin_user }} |
| 39 | password: {{ admin_password }} |
| 40 | project_name: {{ admin_project }} |
| 41 | |
| 42 | {% for role in roles %} |
| 43 | - name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}" |
| 44 | keystone_user: |
| 45 | user: "{{ name }}" |
| 46 | role: "{{ role }}" |
| 47 | tenant: "{{ project }}" |
| 48 | endpoint: {{ endpoint }} |
| 49 | login_user: {{ admin_user }} |
| 50 | login_password: {{ admin_password }} |
| 51 | login_tenant_name: {{ admin_project }} |
| 52 | {% endfor %} |
| 53 | |
| 54 | # FIXME: the below should work in Ansible 2.1, once we get the Admin/admin and |
| 55 | # Member/user role name issues straightened out. |
| 56 | # |
| 57 | # - name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}" |
| 58 | # os_user_role: |
| 59 | # user: "{{ name }}" |
| 60 | # role: "{{ role }}" |
| 61 | # project: "{{ project }}" |
| 62 | # auth: |
| 63 | # auth_url: {{ endpoint }} |
| 64 | # username: {{ admin_user }} |
| 65 | # password: {{ admin_password }} |
| 66 | # project_name: {{ admin_project }} |