From 3fa0aa2ddc31e3ff41c85c1c35eb276dbd1700e2 Mon Sep 17 00:00:00 2001 From: rthallisey Date: Fri, 28 Aug 2015 18:29:43 -0400 Subject: [PATCH] Replace config-external with a JSON file for Glance Change-Id: I14187db31a009c150424ea28b854a78c9ae3941d Partially-Implements: blueprint replace-config-external --- ansible/roles/glance/tasks/bootstrap.yml | 2 +- ansible/roles/glance/tasks/config.yml | 10 ++++++++++ ansible/roles/glance/tasks/start.yml | 4 ++-- ansible/roles/glance/templates/glance-api.json.j2 | 11 +++++++++++ .../roles/glance/templates/glance-registry.json.j2 | 11 +++++++++++ docker/glance/glance-api/start.sh | 11 +++++------ docker/glance/glance-registry/start.sh | 11 +++++------ 7 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 ansible/roles/glance/templates/glance-api.json.j2 create mode 100644 ansible/roles/glance/templates/glance-registry.json.j2 diff --git a/ansible/roles/glance/tasks/bootstrap.yml b/ansible/roles/glance/tasks/bootstrap.yml index 3d62f21667..86be5c3f15 100644 --- a/ansible/roles/glance/tasks/bootstrap.yml +++ b/ansible/roles/glance/tasks/bootstrap.yml @@ -58,7 +58,7 @@ insecure_registry: "{{ docker_insecure_registry }}" name: bootstrap_glance image: "{{ glance_api_image_full }}" - volumes: "{{ node_config_directory }}/glance-api/:/opt/kolla/glance-api/:ro" + volumes: "{{ node_config_directory }}/glance-api/:/opt/kolla/config_files/:ro" volumes_from: - glance_data env: diff --git a/ansible/roles/glance/tasks/config.yml b/ansible/roles/glance/tasks/config.yml index 4cb64ac952..095559dbef 100644 --- a/ansible/roles/glance/tasks/config.yml +++ b/ansible/roles/glance/tasks/config.yml @@ -18,6 +18,11 @@ - "{{ node_templates_directory }}/glance-registry/glance-registry.conf_augment" config_dest: "{{ node_config_directory }}/glance-registry/glance-registry.conf" +- name: Copying over Glance Registry JSON configuration file + template: + src: "roles/glance/templates/glance-registry.json.j2" + dest: "{{ node_config_directory }}/glance-registry/config.json" + - include: ../../config.yml vars: service_name: "glance-api" @@ -36,3 +41,8 @@ - "{{ 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" + +- name: Copying over Glance API JSON configuration file + template: + src: "roles/glance/templates/glance-api.json.j2" + dest: "{{ node_config_directory }}/glance-api/config.json" diff --git a/ansible/roles/glance/tasks/start.yml b/ansible/roles/glance/tasks/start.yml index 755526249d..068fc996cf 100644 --- a/ansible/roles/glance/tasks/start.yml +++ b/ansible/roles/glance/tasks/start.yml @@ -13,7 +13,7 @@ insecure_registry: "{{ docker_insecure_registry }}" name: glance_registry image: "{{ glance_registry_image_full }}" - volumes: "{{ node_config_directory }}/glance-registry/:/opt/kolla/glance-registry/:ro" + volumes: "{{ node_config_directory }}/glance-registry/:/opt/kolla/config_files/:ro" volumes_from: - glance_data env: @@ -34,7 +34,7 @@ insecure_registry: "{{ docker_insecure_registry }}" name: glance_api image: "{{ glance_api_image_full }}" - volumes: "{{ node_config_directory }}/glance-api/:/opt/kolla/glance-api/:ro" + volumes: "{{ node_config_directory }}/glance-api/:/opt/kolla/config_files/:ro" env: KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" when: inventory_hostname in groups['glance-api'] diff --git a/ansible/roles/glance/templates/glance-api.json.j2 b/ansible/roles/glance/templates/glance-api.json.j2 new file mode 100644 index 0000000000..d4be6d6986 --- /dev/null +++ b/ansible/roles/glance/templates/glance-api.json.j2 @@ -0,0 +1,11 @@ +{ + "command": "/usr/bin/glance-api", + "config_files": [ + { + "source": "/opt/kolla/config_files/glance-api.conf", + "dest": "/etc/glance/glance-api.conf", + "owner": "glance", + "perm": "0600" + } + ] +} diff --git a/ansible/roles/glance/templates/glance-registry.json.j2 b/ansible/roles/glance/templates/glance-registry.json.j2 new file mode 100644 index 0000000000..f439b57c83 --- /dev/null +++ b/ansible/roles/glance/templates/glance-registry.json.j2 @@ -0,0 +1,11 @@ +{ + "command": "/usr/bin/glance-registry", + "config_files": [ + { + "source": "/opt/kolla/config_files/glance-registry.conf", + "dest": "/etc/glance/glance-registry.conf", + "owner": "glance", + "perm": "0600" + } + ] +} diff --git a/docker/glance/glance-api/start.sh b/docker/glance/glance-api/start.sh index ce3cb6d8bb..7ceead556a 100755 --- a/docker/glance/glance-api/start.sh +++ b/docker/glance/glance-api/start.sh @@ -1,14 +1,12 @@ #!/bin/bash set -o errexit -CMD="/usr/bin/glance-api" -ARGS="" - # Loading common functions. source /opt/kolla/kolla-common.sh -# Execute config strategy -set_configs +# Generate run command +python /opt/kolla/set_configs.py +CMD=$(cat /run_command) # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. @@ -17,4 +15,5 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -exec $CMD $ARGS +echo "Running command: ${CMD}" +exec $CMD diff --git a/docker/glance/glance-registry/start.sh b/docker/glance/glance-registry/start.sh index 1d8265f80a..6191ce8512 100755 --- a/docker/glance/glance-registry/start.sh +++ b/docker/glance/glance-registry/start.sh @@ -1,13 +1,12 @@ #!/bin/bash set -o errexit -CMD="/usr/bin/glance-registry" -ARGS="" - # Loading common functions. source /opt/kolla/kolla-common.sh -# Execute config strategy -set_configs +# Generate run command +python /opt/kolla/set_configs.py +CMD=$(cat /run_command) -exec $CMD $ARGS +echo "Running command: ${CMD}" +exec $CMD