diff --git a/ansible/roles/horizon/defaults/main.yml b/ansible/roles/horizon/defaults/main.yml index fe2e884377..e07b9ba0aa 100644 --- a/ansible/roles/horizon/defaults/main.yml +++ b/ansible/roles/horizon/defaults/main.yml @@ -7,3 +7,15 @@ project_name: "horizon" horizon_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-horizon" horizon_tag: "{{ openstack_release }}" horizon_image_full: "{{ horizon_image }}:{{ horizon_tag }}" + + +#################### +# OpenStack +#################### +openstack_horizon_auth: "{'auth_url':'{{ openstack_auth.auth_url }}','username':'{{ openstack_auth.username }}','password':'{{ openstack_auth.password }}','project_name':'{{ openstack_auth.project_name }}'}" + + +#################### +# Horizon +#################### +horizon_openstack_keystone_default_role: "_member_" diff --git a/ansible/roles/horizon/tasks/deploy.yml b/ansible/roles/horizon/tasks/deploy.yml index 1f16915ad9..16fae2dadc 100644 --- a/ansible/roles/horizon/tasks/deploy.yml +++ b/ansible/roles/horizon/tasks/deploy.yml @@ -1,4 +1,6 @@ --- - include: config.yml +- include: register.yml + - include: start.yml diff --git a/ansible/roles/horizon/tasks/register.yml b/ansible/roles/horizon/tasks/register.yml new file mode 100644 index 0000000000..0c78e9821f --- /dev/null +++ b/ansible/roles/horizon/tasks/register.yml @@ -0,0 +1,13 @@ +--- +- name: Creating the _member_ role + command: docker exec -t kolla_toolbox /usr/bin/ansible localhost + -m os_keystone_role + -a "name={{ horizon_openstack_keystone_default_role }} + auth={{ '{{ openstack_horizon_auth }}' }}" + -e "{'openstack_horizon_auth':{{ openstack_horizon_auth }}}" + register: horizon_role + changed_when: "{{ horizon_role.stdout.find('localhost | SUCCESS => ') != -1 and (horizon_role.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" + until: horizon_role.stdout.split()[2] == 'SUCCESS' + retries: 10 + delay: 5 + run_once: True diff --git a/ansible/roles/horizon/templates/local_settings.j2 b/ansible/roles/horizon/templates/local_settings.j2 index 4e41d4bad2..9d476c7d65 100644 --- a/ansible/roles/horizon/templates/local_settings.j2 +++ b/ansible/roles/horizon/templates/local_settings.j2 @@ -160,7 +160,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' OPENSTACK_HOST = "{{ kolla_internal_fqdn }}" OPENSTACK_KEYSTONE_URL = "{{ keystone_public_url }}" -OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_" +OPENSTACK_KEYSTONE_DEFAULT_ROLE = "{{ horizon_openstack_keystone_default_role }}" # Enables keystone web single-sign-on if set to True. #WEBSSO_ENABLED = False