diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index 570c4b645c..621a9c778a 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -9,3 +9,6 @@ support [keystone:children] support + +[glance:children] +support diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index a14fc6726d..a38f7c035d 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -12,3 +12,9 @@ support [message-broker:children] support + +[keystone:children] +support + +[glance:children] +support diff --git a/ansible/roles/config.yml b/ansible/roles/config.yml index a941e89ee9..a0cd5ea2ae 100644 --- a/ansible/roles/config.yml +++ b/ansible/roles/config.yml @@ -1,13 +1,13 @@ --- - name: Ensuring templates config directory exists file: - path: "{{ node_templates_directory }}/{{ project_name }}" + path: "{{ node_templates_directory }}/{{ service_name }}" state: "directory" recurse: yes - name: Ensuring config directory exists file: - path: "{{ node_config_directory }}/{{ project_name }}" + path: "{{ node_config_directory }}/{{ service_name }}" state: "directory" - name: Copying over config(s) diff --git a/ansible/roles/database/tasks/config.yml b/ansible/roles/database/tasks/config.yml index a5f55483f5..ce7ff973e7 100644 --- a/ansible/roles/database/tasks/config.yml +++ b/ansible/roles/database/tasks/config.yml @@ -1,8 +1,7 @@ --- - - - include: ../../config.yml vars: + service_name: "mariadb" config_source: - "roles/database/templates/galera.cnf.j2" config_template_dest: diff --git a/ansible/roles/glance/defaults/main.yml b/ansible/roles/glance/defaults/main.yml new file mode 100644 index 0000000000..b1b14aaf4c --- /dev/null +++ b/ansible/roles/glance/defaults/main.yml @@ -0,0 +1,49 @@ +--- +project_name: "glance" + +#################### +# Database +#################### +glance_database_name: "glance" +glance_database_user: "glance" +glance_database_address: "{{ kolla_internal_address }}" + +# Do not override "service_*" variables +service_database_name: "{{ glance_database_name }}" +service_database_user: "{{ glance_database_user }}" +service_database_password: "{{ glance_database_password }}" + + +#################### +# Docker +#################### +docker_glance_registry: "{{ docker_registry }}" +docker_glance_namespace: "{{ docker_namespace }}" +kolla_glance_base_distro: "{{ kolla_base_distro }}" +kolla_glance_install_type: "{{ kolla_install_type }}" +kolla_glance_registry_container_name: "glance-registry" +kolla_glance_api_container_name: "glance-api" + +docker_glance_registry_image: "{{ docker_glance_registry }}{{ docker_glance_namespace }}/{{ kolla_glance_base_distro }}-{{ kolla_glance_install_type }}-{{ kolla_glance_registry_container_name }}" +docker_glance_registry_tag: "{{ openstack_release }}" +docker_glance_registry_image_full: "{{ docker_glance_registry_image }}:{{ docker_glance_api_tag }}" + +docker_glance_api_image: "{{ docker_glance_registry }}{{ docker_glance_namespace }}/{{ kolla_glance_base_distro }}-{{ kolla_glance_install_type }}-{{ kolla_glance_api_container_name }}" +docker_glance_api_tag: "{{ openstack_release }}" +docker_glance_api_image_full: "{{ docker_glance_api_image }}:{{ docker_glance_api_tag }}" + + +#################### +# Openstack +#################### +glance_public_address: "{{ kolla_external_address }}" +glance_admin_address: "{{ kolla_internal_address }}" +glance_internal_address: "{{ kolla_internal_address }}" + +glance_registry_port: "9191" +glance_api_port: "9292" + +glance_logging_verbose: "{{ openstack_logging_verbose }}" +glance_logging_debug: "{{ openstack_logging_debug }}" + +glance_keystone_user: "glance" diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml new file mode 100644 index 0000000000..00c8f60a70 --- /dev/null +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -0,0 +1,12 @@ +--- +- include: ../../bootstrap.yml + vars: + container_detach: False + container_environment: + KOLLA_BOOTSTRAP: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + container_image: "{{ docker_glance_api_image_full }}" + container_name: "bootstrap_glance_api" + container_restart_policy: "no" + container_volumes: + - "{{ node_config_directory }}/glance-api/:/opt/kolla/glance-api/:ro" diff --git a/ansible/roles/glance/tasks/config.yml b/ansible/roles/glance/tasks/config.yml new file mode 100644 index 0000000000..381eff5e5f --- /dev/null +++ b/ansible/roles/glance/tasks/config.yml @@ -0,0 +1,36 @@ +--- +- include: ../../config.yml + vars: + service_name: "glance-registry" + config_source: + - "roles/glance/templates/glance-registry.conf.j2" + - "/etc/kolla/config/global.conf" + - "/etc/kolla/config/database.conf" + - "/etc/kolla/config/glance.conf" + - "/etc/kolla/config/glance/glance-registry.conf" + config_template_dest: + - "{{ node_templates_directory }}/glance-registry/glance.conf_minimal" + - "{{ node_templates_directory }}/glance-registry/glance.conf_global" + - "{{ node_templates_directory }}/glance-registry/glance.conf_database" + - "{{ node_templates_directory }}/glance-registry/glance.conf_augment" + - "{{ node_templates_directory }}/glance-registry/glance-registry.conf_augment" + config_dest: "{{ node_config_directory }}/glance-registry/glance-registry.conf" + +- include: ../../config.yml + vars: + service_name: "glance-api" + config_source: + - "roles/glance/templates/glance-api.conf.j2" + - "/etc/kolla/config/global.conf" + - "/etc/kolla/config/database.conf" + - "/etc/kolla/config/messaging.conf" + - "/etc/kolla/config/glance.conf" + - "/etc/kolla/config/glance/glance-api.conf" + config_template_dest: + - "{{ node_templates_directory }}/glance-api/glance.conf_minimal" + - "{{ node_templates_directory }}/glance-api/glance.conf_global" + - "{{ node_templates_directory }}/glance-api/glance.conf_database" + - "{{ node_templates_directory }}/glance-api/glance.conf_messaging" + - "{{ node_templates_directory }}/glance-api/glance.conf_augment" + - "{{ node_templates_directory }}/glance-api/glance-api.conf_augment" + config_dest: "{{ node_config_directory }}/glance-api/glance-api.conf" diff --git a/ansible/roles/glance/tasks/main.yml b/ansible/roles/glance/tasks/main.yml new file mode 100644 index 0000000000..2821641c4b --- /dev/null +++ b/ansible/roles/glance/tasks/main.yml @@ -0,0 +1,8 @@ +--- +- include: config.yml + +- include: bootstrap.yml + +- include: start.yml + +#- include: register.yml diff --git a/ansible/roles/glance/tasks/register.yml b/ansible/roles/glance/tasks/register.yml new file mode 100644 index 0000000000..8ee20320bb --- /dev/null +++ b/ansible/roles/glance/tasks/register.yml @@ -0,0 +1,12 @@ +--- +# NB: Not an Attorney +# +# Upstream ansible will have all of the new modules we need based on +# the shade library. They are written, but the keystone modules haven't3 +# been merged yet. None of the modules will land before Ansible 2.0. +# +# These new modules will be relicensed using ASL2.0 as the result of a +# gentlemen's agreement that the Kolla authors will not alter the Shade code. +# This does not place additional restrictions on the license of this work. The +# relicense agreement is based upon trust, not something legally binding and +# has no binding impact on the license of Kolla.. diff --git a/ansible/roles/glance/tasks/start.yml b/ansible/roles/glance/tasks/start.yml new file mode 100644 index 0000000000..86c140722b --- /dev/null +++ b/ansible/roles/glance/tasks/start.yml @@ -0,0 +1,18 @@ +--- +- include: ../../start.yml + vars: + container_environment: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + container_image: "{{ docker_glance_registry_image_full }}" + container_name: "glance_registry" + container_volumes: + - "{{ node_config_directory }}/glance-registry/:/opt/kolla/glance-registry/:ro" + +- include: ../../start.yml + vars: + container_environment: + KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" + container_image: "{{ docker_glance_api_image_full }}" + container_name: "glance_api" + container_volumes: + - "{{ node_config_directory }}/glance-api/:/opt/kolla/glance-api/:ro" diff --git a/ansible/roles/glance/templates/glance-api.conf.j2 b/ansible/roles/glance/templates/glance-api.conf.j2 new file mode 100644 index 0000000000..ed1a981275 --- /dev/null +++ b/ansible/roles/glance/templates/glance-api.conf.j2 @@ -0,0 +1,30 @@ +[DEFAULT] +verbose = true +debug = true + +bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} + +rabbit_host = {{ kolla_internal_address }} +rabbit_userid = {{ rabbitmq_user }} +rabbit_password = {{ rabbitmq_password }} +rabbit_ha_queues = true + +notification_driver = nova.openstack.common.notifier.rpc_notifier + +registry_host = {{ kolla_internal_address }} + +[database] +connection = mysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }} + +[keystone_authtoken] +auth_uri = http://{{ kolla_internal_address }}:{{ keystone_public_port }} +auth_url = http://{{ kolla_internal_address }}:{{ keystone_admin_port }} +auth_plugin = password +project_domain_id = default +user_domain_id = default +project_name = service +username = {{ glance_keystone_user }} +password = {{ glance_keystone_password }} + +[paste_deploy] +flavor = keystone diff --git a/ansible/roles/glance/templates/glance-registry.conf.j2 b/ansible/roles/glance/templates/glance-registry.conf.j2 new file mode 100644 index 0000000000..b494e09030 --- /dev/null +++ b/ansible/roles/glance/templates/glance-registry.conf.j2 @@ -0,0 +1,21 @@ +[DEFAULT] +verbose = true +debug = true + +bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} + +[database] +connection = mysql://{{ glance_database_user }}:{{ glance_database_password }}@{{ glance_database_address }}/{{ glance_database_name }} + +[keystone_authtoken] +auth_uri = http://{{ kolla_internal_address }}:{{ keystone_public_port }} +auth_url = http://{{ kolla_internal_address }}:{{ keystone_admin_port }} +auth_plugin = password +project_domain_id = default +user_domain_id = default +project_name = service +username = {{ glance_keystone_user }} +password = {{ glance_keystone_password }} + +[paste_deploy] +flavor = keystone diff --git a/ansible/roles/keystone/tasks/config.yml b/ansible/roles/keystone/tasks/config.yml index 905e3d9372..ef832f7e40 100644 --- a/ansible/roles/keystone/tasks/config.yml +++ b/ansible/roles/keystone/tasks/config.yml @@ -1,6 +1,7 @@ --- - include: ../../config.yml vars: + service_name: "keystone" config_source: - "roles/keystone/templates/keystone.conf.j2" - "/etc/kolla/config/global.conf" diff --git a/ansible/site.yml b/ansible/site.yml index f741695708..4ba9f95512 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -13,3 +13,8 @@ roles: - keystone tags: keystone + +- hosts: glance + roles: + - glance + tags: glance diff --git a/docker/common/glance/glance-api/start.sh b/docker/common/glance/glance-api/start.sh index 152fb019f1..26db7fc1c9 100755 --- a/docker/common/glance/glance-api/start.sh +++ b/docker/common/glance/glance-api/start.sh @@ -10,4 +10,11 @@ source /opt/kolla/kolla-common.sh # Config-internal script exec out of this function, it does not return here. set_configs +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "glance-manage db_sync" glance + exit 0 +fi + exec $CMD $ARGS diff --git a/docker/common/glance/glance-registry/start.sh b/docker/common/glance/glance-registry/start.sh index e77232cf71..70899985e7 100755 --- a/docker/common/glance/glance-registry/start.sh +++ b/docker/common/glance/glance-registry/start.sh @@ -10,11 +10,4 @@ source /opt/kolla/kolla-common.sh # Config-internal script exec out of this function, it does not return here. set_configs -# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases -# of the KOLLA_BOOTSTRAP variable being set, including empty. -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then - su -s /bin/sh -c "glance-manage db_sync" glance - exit 0 -fi - exec $CMD $ARGS diff --git a/etc/kolla/config/glance.conf b/etc/kolla/config/glance.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/etc/kolla/config/glance/glance-api.conf b/etc/kolla/config/glance/glance-api.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/etc/kolla/config/glance/glance-registry.conf b/etc/kolla/config/glance/glance-registry.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index 09ae1f0428..3c0ae3b621 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -76,5 +76,4 @@ keystone_admin_port: "35357" #################### # RabbitMQ options #################### -#placeholder - +rabbitmq_user: "openstack" diff --git a/etc/kolla/passwords.yml b/etc/kolla/passwords.yml index 204d68c9c3..6089b283a0 100644 --- a/etc/kolla/passwords.yml +++ b/etc/kolla/passwords.yml @@ -22,6 +22,9 @@ keystone_admin_token: "password" keystone_admin_password: "password" keystone_database_password: "password" +glance_database_password: "password" +glance_keystone_password: "password" + #################### # RabbitMQ options