From d826dbc33792dd24ef0543ad0fcb00af4a538baa Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Wed, 30 Aug 2017 10:40:40 +0200 Subject: [PATCH] Register keystone endpoints for glance --- defaults/main.yml | 24 ++++++++++++++++++++++++ tasks/hiera.yml | 13 +++++++++++-- tasks/keystone.yml | 39 +++++++++++++++++++++++++++++++++++++++ tasks/provision.yml | 11 ++--------- 4 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 tasks/keystone.yml diff --git a/defaults/main.yml b/defaults/main.yml index b6a96f4..4ce02a2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,8 +6,32 @@ action: provision hiera_data: {} hiera_data_file: '' +keystone_config: + admin_username: 'admin' + admin_project_name: 'admin' + admin_domain_name: 'default' + admin_password: 'weakpassword' + glance_config: DEFAULT: public_bind_host: "0.0.0.0" database: connection: "mysql+pymysql://root:weakpassword@mariadb:3306/glance" + + # NOTE(flaper87): Auth section for config file + keystone_authtoken: + auth_uri: 'http://keystone:35357' + auth_url: 'http://keystone:5000/v3' + password: weakpassword + username: 'glance' + project: 'admin' + + # NOTE(flaper87): Required for registering the keystone endpoint + keystone_default_domain: 'default' + keystone_region: 'regionOne' + keystone_project: 'admin' + keystone_public_url: 'http://glance:9292' + keystone_internal_url: 'http://glance:9292' + keystone_admin_url: 'http://glance:9292' + keystone_user_password: 'weakpassword' + keystone_username: 'glance' diff --git a/tasks/hiera.yml b/tasks/hiera.yml index 91527ab..72d8a61 100644 --- a/tasks/hiera.yml +++ b/tasks/hiera.yml @@ -18,8 +18,8 @@ glance::api::show_image_direct_url: DEFAULT.show_image_direct_url glance::api::show_multiple_locations: DEFAULT.show_multiple_locations - glance::api::authtoken::auth_uri: keystone_authtoken.auth_uri - glance::api::authtoken::auth_url: keystone_authtoken.auth_url + keystone_auth_uri: keystone_authtoken.auth_uri + keystone_identity_uri: keystone_authtoken.auth_url glance::api::authtoken::password: keystone_authtoken.password glance::api::authtoken::username: keystone_authtoken.username glance::api::authtoken::project: keystone_authtoken.project @@ -44,6 +44,15 @@ glance::notification_driver: oslo_messaging_notifications.driver glance::notification_topics: oslo_messaging_notifications.topics + # NOTE(flaper87): Required for registering the keystone endpoint + keystone_region: keystone_region + keystone_default_domain: keystone_default_domain + glance::keystone::auth::tenant: keystone_tenant + glance::keystone::auth::public_url: keystone_public_url + glance::keystone::auth::internal_url: keystone_internal_url + glance::keystone::auth::admin_url: keystone_admin_url + glance::keystone::auth::password: keystone_user_password + default: '{{glance_config}}' fact_variable: 'glance_config' diff --git a/tasks/keystone.yml b/tasks/keystone.yml new file mode 100644 index 0000000..731ac2a --- /dev/null +++ b/tasks/keystone.yml @@ -0,0 +1,39 @@ +#- name: Read keystone_config +# include_role: +# name: ansible-role-k8s-keystone +# tasks_from: hiera + +- name: Register Glance in Keystone + include_role: + name: ansible-role-k8s-tripleo + tasks_from: bootstrap-service-endpoints + vars: + auth_url: '{{glance_config.keystone_authtoken.auth_url}}' + username: '{{keystone_config.admin_username}}' + password: '{{keystone_config.admin_password}}' + project_name: '{{keystone_config.admin_project_name}}' + domain_name: '{{keystone_config.admin_domain_name}}' + service_name: 'glance' + service_type: 'image' + service_region: 'RegionOne' + service_project: '{{glance_config.keystone_authtoken.project}}' + service_password: '{{glance_config.keystone_authtoken.password}}' + service_username: '{{glance_config.keystone_authtoken.username}}' + service_internal_url: '{{glance_config.keystone_internal_url}}' + service_public_url: '{{glance_config.keystone_public_url}}' + service_admin_url: '{{glance_config.keystone_admin_url}}' + +#- name: Create keystone user +# os_user: +# auth: +# auth_url: '{{glance_config.keystone_authtoken.auth_url}}' +# username: '{{keystone_config.admin_username}}' +# password: '{{keystone_config.admin_password}}' +# project_name: '{{keystone_config.admin_project_name}}' +# state: present +# name: '{{glance_config.keystone_username}}' +# password: '{{glance_config.keystone_user_password}}' +# update_password: on_create +# domain: '{{glance_config.keystone_default_domain}}' +# default_project: '{{glance_config.keystone_project}}' +# diff --git a/tasks/provision.yml b/tasks/provision.yml index e3f60b6..56597e1 100644 --- a/tasks/provision.yml +++ b/tasks/provision.yml @@ -1,12 +1,3 @@ -- name: Create project - k8s_v1_namespace: - host: "{{coe_host}}" - context: "{{kube_context}}" - kubeconfig: "{{config_file}}" - name: openstack - state: present - debug: yes - - name: Upload config files template: src: "{{item}}" @@ -175,3 +166,5 @@ config_map: name: glance state: present + +- include: keystone.yml