summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/keystone/tasks/keystone_create.yml
blob: 10228952d68196e2e5a1fd66e3c81ade62cee998 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
---
- name: set admin url for keystone endpoint
  keystone_endpoint:
    cloud: opnfv
    endpoint_type: admin
    name: "{{ item.name }}"
    service_type: "{{ item.type }}"
    state: present
    interface: admin
    region: "{{ item.region}}"
    url: "{{ item.adminurl }}"
  with_items: "{{ os_services[0:1] }}"

- name: set internal url for keystone endpointl
  keystone_endpoint:
    cloud: opnfv
    endpoint_type: admin
    name: "{{ item.name }}"
    service_type: "{{ item.type }}"
    state: present
    interface: internal
    region: "{{ item.region}}"
    url: "{{ item.internalurl }}"
  with_items: "{{ os_services[0:1] }}"

- name: set public url for keystone endpoint
  keystone_endpoint:
    cloud: opnfv
    endpoint_type: admin
    name: "{{ item.name }}"
    service_type: "{{ item.type }}"
    state: present
    interface: public
    region: "{{ item.region}}"
    url: "{{ item.publicurl }}"
  with_items: "{{ os_services[0:1] }}"

- name: add service
  os_keystone_service:
    cloud: opnfv
    name: "{{ item.name }}"
    description: "{{ item.description }}"
    service_type: "{{ item.type }}"
  with_items: "{{ os_services }}"

- name: add project
  os_project:
    cloud: opnfv
    domain_id: default
    name: "{{ item.tenant }}"
    description: "{{ item.tenant_description }}"
  with_items: "{{ os_users }}"

- name: add user
  os_user:
    cloud: opnfv
    domain: default
    name: "{{ item.user }}"
    password: "{{ item.password }}"
    default_project: "{{ item.tenant }}"
    email: "{{ item.email }}"
  with_items: "{{ os_users }}"

- name: add roles
  os_keystone_role:
    cloud: opnfv
    name: "{{ item.role }}"
  with_items: "{{ os_users }}"

- name: grant roles
  os_user_role:
    cloud: opnfv
    user: "{{ item.user }}"
    role: "{{ item.role }}"
    project: "{{ item.tenant }}"
  with_items: "{{ os_users }}"

- name: create admin url for service's endpoint
  keystone_endpoint:
    cloud: opnfv
    endpoint_type: admin
    name: "{{ item.name }}"
    service_type: "{{ item.type }}"
    state: present
    interface: admin
    region: "{{ item.region}}"
    url: "{{ item.adminurl }}"
  with_items: "{{ os_services[1:] }}"

- name: create internal url for service's endpoint
  keystone_endpoint:
    cloud: opnfv
    endpoint_type: admin
    name: "{{ item.name }}"
    service_type: "{{ item.type }}"
    state: present
    interface: internal
    region: "{{ item.region}}"
    url: "{{ item.internalurl }}"
  with_items: "{{ os_services[1:] }}"

- name: create public url for service'e endpoint
  keystone_endpoint:
    cloud: opnfv
    endpoint_type: admin
    name: "{{ item.name }}"
    service_type: "{{ item.type }}"
    state: present
    interface: public
    region: "{{ item.region}}"
    url: "{{ item.publicurl }}"
  with_items: "{{ os_services[1:] }}"