Adding support of system scoped openrc and clouds.yaml
Change-Id: Iff5a0892d812601c0fa3fd549b7f00a468cfdd97 Closes-Bug: 1903656
This commit is contained in:
parent
87e9d56d06
commit
fdc640ddcb
@ -13,6 +13,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
## Use System Scope Authentication
|
||||||
|
openrc_system_scope: false
|
||||||
|
|
||||||
## Endpoint types
|
## Endpoint types
|
||||||
openrc_cinder_endpoint_type: internalURL
|
openrc_cinder_endpoint_type: internalURL
|
||||||
openrc_nova_endpoint_type: internalURL
|
openrc_nova_endpoint_type: internalURL
|
||||||
@ -32,8 +35,9 @@ openrc_os_domain_name: Default
|
|||||||
openrc_insecure: >-
|
openrc_insecure: >-
|
||||||
{{ (keystone_service_adminuri_insecure | default(false) | bool or
|
{{ (keystone_service_adminuri_insecure | default(false) | bool or
|
||||||
keystone_service_internaluri_insecure | default(false) | bool) }}
|
keystone_service_internaluri_insecure | default(false) | bool) }}
|
||||||
## Create openrc file
|
## Create openrc file(s)
|
||||||
openrc_file_dest: "{{ ansible_env.HOME }}/openrc"
|
openrc_file_dest: "{{ ansible_env.HOME }}/openrc"
|
||||||
|
openrc_system_file_dest: "{{ openrc_file_dest | dirname }}/openrc.system_scope"
|
||||||
openrc_file_owner: "{{ ansible_user_id }}"
|
openrc_file_owner: "{{ ansible_user_id }}"
|
||||||
openrc_file_group: "{{ ansible_user_id }}"
|
openrc_file_group: "{{ ansible_user_id }}"
|
||||||
openrc_file_mode: "0600"
|
openrc_file_mode: "0600"
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The role now supports creating system scoped credentials alongside
|
||||||
|
project scoped credentials. The default behavior of the role did not
|
||||||
|
changed, until ``openrc_system_scope`` variable was set to ``true``.
|
||||||
|
If the ``openrc_system_scope`` is ``true`` the default cloud in
|
||||||
|
clouds.yaml will set to system scoped credentials and another credentials
|
||||||
|
named ``default_project_scope`` will get created with project scoped
|
||||||
|
credentials. Due to usage of openrc file in other roles, the opposite
|
||||||
|
logic applies to openrc files, which means if ``openrc_system_scope``
|
||||||
|
is set to ``true`` the credentials in openrc will set to project scoped
|
||||||
|
credentials and another openrc filec named ``openrc.system_scope`` will
|
||||||
|
get created with system scoped credentials and will be placed in
|
||||||
|
destination of ``openrc_system_file_dest`` variable.
|
@ -15,13 +15,22 @@
|
|||||||
|
|
||||||
- name: Create openrc file
|
- name: Create openrc file
|
||||||
template:
|
template:
|
||||||
src: openrc.j2
|
src: "{{ item.src }}"
|
||||||
dest: "{{ openrc_file_dest }}"
|
dest: "{{ item.dest }}"
|
||||||
owner: "{{ openrc_file_owner }}"
|
owner: "{{ openrc_file_owner }}"
|
||||||
group: "{{ openrc_file_group }}"
|
group: "{{ openrc_file_group }}"
|
||||||
mode: "{{ openrc_file_mode }}"
|
mode: "{{ openrc_file_mode }}"
|
||||||
tags:
|
tags:
|
||||||
- openstack_openrc-config
|
- openstack_openrc-config
|
||||||
|
with_items:
|
||||||
|
- project_scoped_openrc:
|
||||||
|
src: openrc.j2
|
||||||
|
dest: "{{ openrc_file_dest }}"
|
||||||
|
- system_scoped_openrc:
|
||||||
|
src: openrc-system-scope.j2
|
||||||
|
dest: "{{ openrc_system_file_dest }}"
|
||||||
|
condition: "{{ openrc_system_scope | default(false) | bool }}"
|
||||||
|
when: item.condition | default(True)
|
||||||
|
|
||||||
- name: Create OpenStack client configuration directory
|
- name: Create OpenStack client configuration directory
|
||||||
file:
|
file:
|
||||||
|
@ -3,12 +3,16 @@ clouds:
|
|||||||
default:
|
default:
|
||||||
auth:
|
auth:
|
||||||
auth_url: {{ openrc_os_auth_url }}
|
auth_url: {{ openrc_os_auth_url }}
|
||||||
|
{% if openrc_system_scope | default(false) | bool %}
|
||||||
|
system_scope: all
|
||||||
|
{% else %}
|
||||||
project_name: {{ openrc_os_tenant_name }}
|
project_name: {{ openrc_os_tenant_name }}
|
||||||
tenant_name: {{ openrc_os_tenant_name }}
|
tenant_name: {{ openrc_os_tenant_name }}
|
||||||
|
project_domain_name: {{ openrc_os_domain_name }}
|
||||||
|
{% endif %}
|
||||||
username: {{ openrc_os_username }}
|
username: {{ openrc_os_username }}
|
||||||
password: {{ openrc_os_password }}
|
password: {{ openrc_os_password }}
|
||||||
user_domain_name: {{ openrc_os_domain_name }}
|
user_domain_name: {{ openrc_os_domain_name }}
|
||||||
project_domain_name: {{ openrc_os_domain_name }}
|
|
||||||
region_name: {{ openrc_region_name }}
|
region_name: {{ openrc_region_name }}
|
||||||
interface: {{ openrc_clouds_yml_interface }}
|
interface: {{ openrc_clouds_yml_interface }}
|
||||||
{% if openrc_os_auth_url.endswith('v2.0') %}
|
{% if openrc_os_auth_url.endswith('v2.0') %}
|
||||||
@ -20,3 +24,25 @@ clouds:
|
|||||||
verify: false
|
verify: false
|
||||||
insecure: true
|
insecure: true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if openrc_system_scope | default(false) | bool %}
|
||||||
|
default_project_scope:
|
||||||
|
auth:
|
||||||
|
auth_url: {{ openrc_os_auth_url }}
|
||||||
|
project_name: {{ openrc_os_tenant_name }}
|
||||||
|
tenant_name: {{ openrc_os_tenant_name }}
|
||||||
|
project_domain_name: {{ openrc_os_domain_name }}
|
||||||
|
username: {{ openrc_os_username }}
|
||||||
|
password: {{ openrc_os_password }}
|
||||||
|
user_domain_name: {{ openrc_os_domain_name }}
|
||||||
|
region_name: {{ openrc_region_name }}
|
||||||
|
interface: {{ openrc_clouds_yml_interface }}
|
||||||
|
{% if openrc_os_auth_url.endswith('v2.0') %}
|
||||||
|
identity_api_version: "2.0"
|
||||||
|
{% else %}
|
||||||
|
identity_api_version: "3"
|
||||||
|
{% endif %}
|
||||||
|
{% if openrc_insecure | bool %}
|
||||||
|
verify: false
|
||||||
|
insecure: true
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
48
templates/openrc-system-scope.j2
Normal file
48
templates/openrc-system-scope.j2
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
export LC_ALL={{ openrc_locale }}
|
||||||
|
|
||||||
|
# COMMON CINDER ENVS
|
||||||
|
export CINDER_ENDPOINT_TYPE={{ openrc_cinder_endpoint_type }}
|
||||||
|
|
||||||
|
# COMMON NOVA ENVS
|
||||||
|
export NOVA_ENDPOINT_TYPE={{ openrc_nova_endpoint_type }}
|
||||||
|
|
||||||
|
# COMMON MANILA ENVS
|
||||||
|
export OS_MANILA_ENDPOINT_TYPE={{ openrc_manila_endpoint_type }}
|
||||||
|
|
||||||
|
# COMMON OPENSTACK ENVS
|
||||||
|
export OS_ENDPOINT_TYPE={{ openrc_os_endpoint_type }}
|
||||||
|
export OS_INTERFACE={{ openrc_os_endpoint_type }}
|
||||||
|
export OS_USERNAME={{ openrc_os_username }}
|
||||||
|
export OS_PASSWORD='{{ openrc_os_password }}'
|
||||||
|
export OS_AUTH_TYPE={{ openrc_os_auth_type }}
|
||||||
|
export OS_AUTH_URL={{ openrc_os_auth_url }}
|
||||||
|
export OS_NO_CACHE=1
|
||||||
|
export OS_USER_DOMAIN_NAME={{ openrc_os_domain_name }}
|
||||||
|
export OS_REGION_NAME={{ openrc_region_name }}
|
||||||
|
export OS_SYSTEM_SCOPE=all
|
||||||
|
|
||||||
|
# For openstackclient
|
||||||
|
{% if openrc_os_auth_url.endswith('v2.0') %}
|
||||||
|
export OS_IDENTITY_API_VERSION=2.0
|
||||||
|
export OS_AUTH_VERSION=2
|
||||||
|
{% else %}
|
||||||
|
export OS_IDENTITY_API_VERSION=3
|
||||||
|
export OS_AUTH_VERSION=3
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if openrc_insecure | bool %}
|
||||||
|
export OS_INSECURE='true'
|
||||||
|
export OS_VERIFY='false'
|
||||||
|
# Convenience Aliases for Self-Signed Certs
|
||||||
|
alias cinder='cinder --insecure'
|
||||||
|
alias glance='glance --insecure'
|
||||||
|
alias heat='heat --insecure'
|
||||||
|
alias keystone='keystone --insecure'
|
||||||
|
alias neutron='neutron --insecure'
|
||||||
|
alias nova='nova --insecure'
|
||||||
|
alias openstack='openstack --insecure'
|
||||||
|
alias swift='swift --insecure'
|
||||||
|
alias tacker='tacker --insecure'
|
||||||
|
alias manila='manila --insecure'
|
||||||
|
{% endif %}
|
Loading…
x
Reference in New Issue
Block a user