From 5ced9d62b4701c8e474873df4bd0a4298eb29984 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kaminski Date: Fri, 29 May 2015 16:13:54 +0200 Subject: [PATCH] Glance: more configs, keystone_user fix --- resources/glance_config/actions/run.yml | 2 ++ resources/glance_config/templates/exports | 4 ++++ resources/keystone_config/actions/run.yml | 3 +++ resources/keystone_config/templates/exports | 2 ++ resources/keystone_user/actions/run.yml | 9 +++++++-- resources/keystone_user/meta.yaml | 5 ++++- resources/mariadb_service/actions/run.yml | 5 +++++ 7 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 resources/glance_config/templates/exports create mode 100644 resources/keystone_config/templates/exports diff --git a/resources/glance_config/actions/run.yml b/resources/glance_config/actions/run.yml index 99debf03..9fa72072 100644 --- a/resources/glance_config/actions/run.yml +++ b/resources/glance_config/actions/run.yml @@ -23,6 +23,7 @@ - file: path={{ config_dir.value['src'] }}/glance-scrubber.conf state=touch - file: path={{ config_dir.value['src'] }}/policy.json state=touch - file: path={{ config_dir.value['src'] }}/schema-image.json state=touch + - file: path={{ config_dir.value['src'] }}/exports state=touch - template: src={{ resource_dir }}/templates/glance-api.conf dest={{ config_dir.value['src'] }}/glance-api.conf - template: src={{ resource_dir }}/templates/glance-api-paste.ini dest={{ config_dir.value['src'] }}/glance-api-paste.ini - template: src={{ resource_dir }}/templates/glance-cache.conf dest={{ config_dir.value['src'] }}/glance-cache.conf @@ -31,3 +32,4 @@ - template: src={{ resource_dir }}/templates/glance-scrubber.conf dest={{ config_dir.value['src'] }}/glance-scrubber.conf - template: src={{ resource_dir }}/templates/policy.json dest={{ config_dir.value['src'] }}/policy.json - template: src={{ resource_dir }}/templates/schema-image.json dest={{ config_dir.value['src'] }}/schema-image.json + - template: src={{ resource_dir }}/templates/exports dest={{ config_dir.value['src'] }}/glance-export diff --git a/resources/glance_config/templates/exports b/resources/glance_config/templates/exports new file mode 100644 index 00000000..c617e27b --- /dev/null +++ b/resources/glance_config/templates/exports @@ -0,0 +1,4 @@ +export OS_TENANT_NAME={{ keystone_admin_tenant }} +export OS_USERNAME={{ keystone_admin_user }} +export OS_PASSWORD={{ keystone_admin_password }} +export OS_AUTH_URL=http://{{ keystone_ip }}:35357/v2.0 \ No newline at end of file diff --git a/resources/keystone_config/actions/run.yml b/resources/keystone_config/actions/run.yml index e24d0fae..ad457c53 100644 --- a/resources/keystone_config/actions/run.yml +++ b/resources/keystone_config/actions/run.yml @@ -2,6 +2,8 @@ sudo: yes vars: admin_token: {{admin_token}} + keystone_host: {{ ip }} + keystone_port: {{ port }} db_user: {{db_user}} db_password: {{db_password}} db_host: {{db_host}} @@ -12,3 +14,4 @@ - template: src={{resource_dir}}/templates/default_catalog.templates dest={{config_dir}}/default_catalog.templates - template: src={{resource_dir}}/templates/logging.conf dest={{config_dir}}/logging.conf - template: src={{resource_dir}}/templates/policy.json dest={{config_dir}}/policy.json + - template: src={{resource_dir}}/templates/exports dest={{ config_dir }}/keystone-exports diff --git a/resources/keystone_config/templates/exports b/resources/keystone_config/templates/exports new file mode 100644 index 00000000..cc3a1c1c --- /dev/null +++ b/resources/keystone_config/templates/exports @@ -0,0 +1,2 @@ +export OS_SERVICE_ENDPOINT=http://localhost:35357/v2.0/ +export OS_SERVICE_TOKEN={{ admin_token }} diff --git a/resources/keystone_user/actions/run.yml b/resources/keystone_user/actions/run.yml index c7063998..7a861d75 100644 --- a/resources/keystone_user/actions/run.yml +++ b/resources/keystone_user/actions/run.yml @@ -1,6 +1,11 @@ - hosts: [{{ ip }}] sudo: yes tasks: + - name: install python-keystoneclient + shell: pip install python-keystoneclient + - name: keystone tenant + keystone_user: endpoint=http://localhost:35357/v2.0/ tenant={{ tenant_name }} token={{ login_token }} state=present - name: keystone user - - keystone_user: endpoint=http://{{ keystone_host }}:{{ keystone_port }}/v2.0/ tenant={{ tenant_name }} token={{ login_token }} state=present - - keystone_user: endpoint=http://{{ keystone_host }}:{{ keystone_port }}/v2.0/ user={{ user_name }} password={{ user_password }} tenant={{ tenant_name }} token={{ login_token }} state=present + keystone_user: endpoint=http://localhost:35357/v2.0/ user={{ user_name }} password={{ user_password }} tenant={{ tenant_name }} token={{ login_token }} state=present + - name: keystone role + keystone_user: endpoint=http://localhost:35357/v2.0/ role={{ role_name }} user={{ user_name }} tenant={{ tenant_name }} token={{ login_token }} state=present diff --git a/resources/keystone_user/meta.yaml b/resources/keystone_user/meta.yaml index 8c9ffb15..07d445a5 100644 --- a/resources/keystone_user/meta.yaml +++ b/resources/keystone_user/meta.yaml @@ -5,7 +5,7 @@ input: keystone_host: schema: str! value: - keystone_port: + keystone_admin_port: schema: int! value: login_user: @@ -14,6 +14,9 @@ input: login_token: schema: str! value: + role_name: + schema: str! + value: user_name: schema: str! value: diff --git a/resources/mariadb_service/actions/run.yml b/resources/mariadb_service/actions/run.yml index b1e9d87f..3be093d2 100644 --- a/resources/mariadb_service/actions/run.yml +++ b/resources/mariadb_service/actions/run.yml @@ -10,3 +10,8 @@ - {{ port }}:3306 env: MYSQL_ROOT_PASSWORD: {{ root_password }} + - shell: docker exec -t {{ name }} mysql -p{{ root_password }} -uroot -e "select 1" + register: result + until: result.rc == 0 + retries: 10 + delay: 0.5