openstack-ansible-os_keystone/tasks/keystone_service_setup.yml
malei fb6e432394 Fix typos in docstrings:
config_template  Line 10: the use of an simple dictionary
keystone_service_setup.yml  Line 45: # Create an service tenant
extending.rst  Line 199: the use of an simple dictionary

Change-Id: I20fec718c8c4f3a0a645852a8b99152698b9cf94
2016-01-25 15:14:55 +00:00

232 lines
6.6 KiB
YAML

---
# Copyright 2014, 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: Restart service
service:
name: "{{ keystone_system_service_name }}"
state: restarted
pattern: "{{ keystone_system_service_name }}"
tags:
- keystone-db-sync
- keystone-setup
- name: Wait for keystone admin to come up
wait_for:
host: "{{ ansible_ssh_host }}"
port: "{{ keystone_admin_port }}"
timeout: 25
delay: 10
tags:
- keystone-db-sync
- keystone-setup
- name: Wait for keystone service to come up
wait_for:
host: "{{ ansible_ssh_host }}"
port: "{{ keystone_service_port }}"
timeout: 25
delay: 10
tags:
- keystone-db-sync
- keystone-setup
# Create a service tenant
- name: Ensure service tenant
keystone:
command: "ensure_tenant"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
tenant_name: "{{ keystone_service_tenant_name }}"
description: "{{ keystone_service_description }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-setup
# Create an admin tenant
- name: Ensure admin tenant
keystone:
command: "ensure_tenant"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
tenant_name: "{{ keystone_admin_tenant_name }}"
description: "{{ keystone_admin_description }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-setup
# Create an admin user
- name: Ensure Admin user
keystone:
command: "ensure_user"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
user_name: "{{ keystone_admin_user_name }}"
tenant_name: "{{ keystone_admin_tenant_name }}"
password: "{{ keystone_auth_admin_password }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
when: not keystone_service_in_ldap | bool
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-setup
# Create an admin role
- name: Ensure Admin role
keystone:
command: "ensure_role"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
role_name: "{{ keystone_role_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-setup
# Add a role to the user
- name: Ensure Admin user to Admin role
keystone:
command: "ensure_user_role"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
user_name: "{{ keystone_admin_user_name }}"
tenant_name: "{{ keystone_admin_tenant_name }}"
role_name: "{{ keystone_role_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
when: not keystone_service_in_ldap | bool
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-setup
# Add the default user role
- name: Ensure default keystone user role
keystone:
command: "ensure_role"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
role_name: "{{ keystone_default_role_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_member_role
when: not keystone_service_in_ldap | bool
until: add_member_role|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-setup
# Create a service
- name: Ensure Keystone Service
keystone:
command: "ensure_service"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
service_name: "{{ keystone_service_name }}"
service_type: "{{ keystone_service_type }}"
description: "{{ keystone_service_description }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-service-add
- keystone-setup
# Create a service user
- name: Ensure Keystone user
keystone:
command: "ensure_user"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
user_name: "{{ keystone_service_user_name }}"
tenant_name: "{{ keystone_service_tenant_name }}"
password: "{{ keystone_service_password }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-service-add
- keystone-setup
# Add a role to the user
- name: Ensure Keystone user to Admin role
keystone:
command: "ensure_user_role"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
user_name: "{{ keystone_service_user_name }}"
tenant_name: "{{ keystone_service_tenant_name }}"
role_name: "{{ keystone_role_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-service-add
- keystone-setup
# Create an endpoint
- name: Ensure Keystone Endpoint
keystone:
command: "ensure_endpoint"
token: "{{ keystone_auth_admin_token }}"
endpoint: "{{ keystone_service_adminurl }}"
region_name: "{{ keystone_service_region }}"
service_name: "{{ keystone_service_name }}"
service_type: "{{ keystone_service_type }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
endpoint_list:
- url: "{{ keystone_service_publicurl }}"
interface: "public"
- url: "{{ keystone_service_adminurl }}"
interface: "admin"
- url: "{{ keystone_service_internalurl }}"
interface: "internal"
register: add_service
until: add_service|success
retries: 5
delay: 10
tags:
- keystone-api-setup
- keystone-service-add
- keystone-setup