openstack-ansible-os_barbican/tasks/service-setup.yml

87 lines
3.2 KiB
YAML

---
# Copyright 2016, Ian Cordasco
#
# 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: Ensure the service for Barbican exists
keystone:
command: "ensure_service"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
service_name: "{{ barbican_service_name }}"
service_type: "{{ barbican_service_type }}"
description: "{{ barbican_service_description }}"
register: add_barbican_service
until: add_barbican_service |success
retries: 5
delay: 2
- name: Ensure the Barbican user exists
keystone:
command: "ensure_user"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
user_name: "{{ barbican_service_user_name }}"
tenant_name: "{{ barbican_service_project_name }}"
password: "{{ barbican_service_password |default('changeme') }}"
register: add_barbican_user
until: add_barbican_user |success
retries: 5
delay: 2
- name: Ensure the Barbican user has the admin role
keystone:
command: "ensure_user_role"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
user_name: "{{ barbican_service_user_name }}"
tenant_name: "{{ barbican_service_project_name }}"
role_name: "{{ item }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
register: ensure_barbican_roles
until: ensure_barbican_roles |success
retries: 5
delay: 2
with_items: "{{ barbican_service_role_names }}"
- name: Ensure the Barbican endpoint is registered
keystone:
command: "ensure_endpoint"
endpoint: "{{ keystone_service_adminurl }}"
login_user: "{{ keystone_admin_user_name }}"
login_password: "{{ keystone_auth_admin_password }}"
login_project_name: "{{ keystone_admin_tenant_name }}"
insecure: "{{ keystone_service_adminuri_insecure }}"
region_name: "{{ barbican_service_region }}"
service_name: "{{ barbican_service_name }}"
service_type: "{{ barbican_service_type }}"
endpoint_list:
- url: "{{ barbican_service_publicurl }}"
interface: "public"
- url: "{{ barbican_service_internalurl }}"
interface: "internal"
- url: "{{ barbican_service_adminurl }}"
interface: "admin"
register: add_barbican_endpoints
until: add_barbican_endpoints |success
retries: 5
delay: 2