Scott Baker | b63ea79 | 2016-08-11 10:24:48 -0700 | [diff] [blame] | 1 | --- |
| 2 | - hosts: 127.0.0.1 |
| 3 | connection: local |
| 4 | tasks: |
| 5 | |
| 6 | - name: Create user account for "{{ name }}" |
| 7 | os_user: |
| 8 | name: "{{ name }}" |
| 9 | email: "{{ email }}" |
| 10 | password: "{{ password }}" |
| 11 | auth: |
| 12 | auth_url: {{ endpoint }} |
| 13 | username: {{ admin_user }} |
| 14 | password: {{ admin_password }} |
| 15 | project_name: {{ admin_project }} |
| 16 | |
| 17 | - name: Create project for "{{ project }}" |
| 18 | os_project: |
| 19 | name: "{{ project }}" |
| 20 | auth: |
| 21 | auth_url: {{ endpoint }} |
| 22 | username: {{ admin_user }} |
| 23 | password: {{ admin_password }} |
| 24 | project_name: {{ admin_project }} |
| 25 | |
| 26 | {% for role in roles %} |
| 27 | - name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}" |
| 28 | keystone_user: |
| 29 | user: "{{ name }}" |
| 30 | role: "{{ role }}" |
| 31 | tenant: "{{ project }}" |
| 32 | endpoint: {{ endpoint }} |
| 33 | login_user: {{ admin_user }} |
| 34 | login_password: {{ admin_password }} |
| 35 | login_tenant_name: {{ admin_project }} |
| 36 | {% endfor %} |
| 37 | |
| 38 | # FIXME: the below should work in Ansible 2.1, once we get the Admin/admin and |
| 39 | # Member/user role name issues straightened out. |
| 40 | # |
| 41 | # - name: Creating role "{{ role }}" for "{{ name }}" on "{{ project }}" |
| 42 | # os_user_role: |
| 43 | # user: "{{ name }}" |
| 44 | # role: "{{ role }}" |
| 45 | # project: "{{ project }}" |
| 46 | # auth: |
| 47 | # auth_url: {{ endpoint }} |
| 48 | # username: {{ admin_user }} |
| 49 | # password: {{ admin_password }} |
| 50 | # project_name: {{ admin_project }} |