/
skydive_keystone.yml
147 lines (135 loc) · 4.75 KB
/
skydive_keystone.yml
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
# Copyright 2019, Rackspace US, Inc.
#
# 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.
- name: Check credentials and clouds data
fail:
msg: >-
The following variable "{{ item.default }}" is undefined and no known value was defined
in the "{{ skydive_os_cloud_file }}" file.
when:
- hostvars[inventory_hostname][item.default] is undefined
- clouds_yaml['clouds'] is undefined
- clouds_yaml['clouds'][skydive_os_cloud] is undefined
- clouds_yaml['clouds'][skydive_os_cloud]['auth'] is undefined
- clouds_yaml['clouds'][skydive_os_cloud]['auth'][item.cfg] is undefined
with_items:
- default: "skydive_os_auth_url"
cfg: "auth_url"
- name: Create service setup environment when localhost is the service setup host
delegate_to: "{{ skydive_service_setup_host }}"
run_once: yes
when:
- skydive_service_setup_host_python_interpreter == '/opt/skydive/bin/python'
block:
- name: Create skydive venv
command: "virtualenv --no-site-packages --no-setuptools /opt/skydive"
args:
creates: /opt/skydive/bin/pip
- name: Setup skydive venv
pip:
name:
- pip
- setuptools
extra_args: "-U"
virtualenv: /opt/skydive
- name: Ensure the openstacksdk is installed
pip:
name:
- openstacksdk
extra_args: "-U --isolated"
virtualenv: /opt/skydive
- name: Show ansible interpreter
debug:
var: skydive_service_setup_host_python_interpreter
- name: Setup the skydive service
delegate_to: "{{ skydive_service_setup_host }}"
run_once: yes
vars:
ansible_python_interpreter: "{{ skydive_service_setup_host_python_interpreter }}"
block:
- name: Ensure clouds file directory
file:
path: "{{ skydive_os_cloud_file | dirname }}"
state: directory
mode: "0750"
- name: Install binary skydive
copy:
content: "{{ clouds_yaml | to_nice_yaml }}"
dest: "{{ skydive_os_cloud_file }}"
mode: "0640"
- name: Add skydive project
os_project:
cloud: "{{ skydive_os_cloud }}"
state: present
name: "{{ skydive_os_project_name }}"
description: "Skydive admin project"
domain_id: "{{ skydive_os_domain_name }}"
verify: "{{ not (skydive_os_service_insecure | bool) }}"
enabled: true
register: keystone_api
until: keystone_api is success
retries: 5
delay: 10
- name: Add skydive user
os_user:
cloud: "{{ skydive_os_cloud }}"
state: present
name: "{{ skydive_os_user_name }}"
password: "{{ skydive_password }}"
update_password: on_create
domain: "{{ skydive_os_domain_name }}"
default_project: "{{ skydive_os_project_name }}"
verify: "{{ not (skydive_os_service_insecure | bool) }}"
enabled: true
register: keystone_api
until: keystone_api is success
retries: 5
delay: 10
- name: Assign skydive user role
os_user_role:
cloud: "{{ skydive_os_cloud }}"
state: present
user: "{{ skydive_os_user_name }}"
role: "{{ skydive_os_user_role }}"
project: "{{ skydive_os_project_name }}"
verify: "{{ not (skydive_os_service_insecure | bool) }}"
register: keystone_api
until: keystone_api is success
retries: 5
delay: 10
- name: Add skydive service user
os_user:
cloud: "{{ skydive_os_cloud }}"
state: present
name: "{{ skydive_os_service_user }}"
password: "{{ skydive_os_service_password }}"
domain: "{{ skydive_os_domain_name }}"
default_project: "{{ skydive_os_project_name }}"
verify: "{{ not (skydive_os_service_insecure | bool) }}"
register: keystone_api
until: keystone_api is success
retries: 5
delay: 10
- name: Assign skydive service user role
os_user_role:
cloud: "{{ skydive_os_cloud }}"
state: present
user: "{{ skydive_os_service_user }}"
role: "{{ skydive_os_service_user_role }}"
project: "{{ skydive_os_project_name }}"
verify: "{{ not (skydive_os_service_insecure | bool) }}"
register: keystone_api
until: keystone_api is success
retries: 5
delay: 10