kolla-ansible/ansible/roles/blazar/tasks/bootstrap.yml
Zhuo Zhen f2d32d2e01 Fix hard-coded admin project name and username in blazar task
In one of the blazar ansible tasks in "bootstrap.yml", the admin
project name and username are hard-coded as "admin". OpenStack
users can define their admin project name and username differently
and the hard-coded names would cause authentication errors.

In addition, keystone identity api version 3 uses "os-project-name"
instead of "os-tenant-name". Although "os-tenant-name" might be
still accepatable, it's better to keep the latest.

Change-Id: Ie5c1016f9ce6f402ef208f3c295e6883a9edd8ab
Closes-bug: #1853462
2019-11-21 08:39:11 -06:00

62 lines
2.1 KiB
YAML

---
- name: Creating blazar database
become: true
kolla_toolbox:
module_name: mysql_db
module_args:
login_host: "{{ database_address }}"
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ blazar_database_name }}"
run_once: True
delegate_to: "{{ groups['blazar-api'][0] }}"
when:
- not use_preconfigured_databases | bool
- name: Creating blazar database user and setting permissions
become: true
kolla_toolbox:
module_name: mysql_user
module_args:
login_host: "{{ database_address }}"
login_port: "{{ database_port }}"
login_user: "{{ database_user }}"
login_password: "{{ database_password }}"
name: "{{ blazar_database_name }}"
password: "{{ blazar_database_password }}"
host: "%"
priv: "{{ blazar_database_name }}.*:ALL"
append_privs: "yes"
run_once: True
delegate_to: "{{ groups['blazar-api'][0] }}"
when:
- not use_preconfigured_databases | bool
# TODO(egonzalez) Use os_nova_host_aggregate ansible module once ansible min version is 2.3
# http://docs.ansible.com/ansible/os_nova_host_aggregate_module.html
- name: Creating blazar host aggregate
become: true
command: >
docker exec kolla_toolbox openstack
--os-interface internal
--os-auth-url {{ openstack_auth.auth_url }}
--os-identity-api-version 3
--os-project-domain-name {{ openstack_auth.domain_name }}
--os-project-name {{ openstack_auth.project_name }}
--os-username {{ openstack_auth.username }}
--os-password {{ openstack_auth.password }}
--os-user-domain-name {{ openstack_auth.user_domain_name }}
--os-region-name {{ openstack_region_name }}
{% if openstack_cacert != '' %}--os-cacert {{ openstack_cacert }}{% endif %}
aggregate create {{ blazar_aggregate_pool_name }}
register: blazar_host_aggregate
changed_when: blazar_host_aggregate is success
failed_when:
- blazar_host_aggregate.rc != 0
- blazar_host_aggregate.stderr.find('already') == -1
run_once: True
delegate_to: "{{ groups['blazar-api'][0] }}"
- include_tasks: bootstrap_service.yml