Optimize reconfiguration for solum
Co-Authored-By: Francisco Edigleison Barbosa <barbosaedigleison@gmail.com> Co-Authored-By: caoyuan <cao.yuan@99cloud.net> Change-Id: I2c8003ac7ce42a621f6152d8d6684890d1645f62 Partially-implements: blueprint better-reconfigure
This commit is contained in:
parent
692c6986f2
commit
edc408c08d
@ -1,6 +1,45 @@
|
|||||||
---
|
---
|
||||||
project_name: "solum"
|
project_name: "solum"
|
||||||
|
|
||||||
|
solum_services:
|
||||||
|
solum-api:
|
||||||
|
container_name: solum_api
|
||||||
|
group: solum-api
|
||||||
|
enabled: true
|
||||||
|
image: "{{ solum_api_image_full }}"
|
||||||
|
volumes:
|
||||||
|
- "{{ node_config_directory }}/solum-api/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
solum-worker:
|
||||||
|
container_name: solum_worker
|
||||||
|
group: solum-worker
|
||||||
|
enabled: true
|
||||||
|
image: "{{ solum_worker_image_full }}"
|
||||||
|
volumes:
|
||||||
|
- "{{ node_config_directory }}/solum-worker/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
solum-deployer:
|
||||||
|
container_name: solum_deployer
|
||||||
|
group: solum-deployer
|
||||||
|
enabled: true
|
||||||
|
image: "{{ solum_deployer_image_full }}"
|
||||||
|
volumes:
|
||||||
|
- "{{ node_config_directory }}/solum-deployer/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
solum-conductor:
|
||||||
|
container_name: solum_conductor
|
||||||
|
group: solum-conductor
|
||||||
|
enabled: true
|
||||||
|
image: "{{ solum_conductor_image_full }}"
|
||||||
|
volumes:
|
||||||
|
- "{{ node_config_directory }}/solum-conductor/:{{ container_config_directory }}/:ro"
|
||||||
|
- "/etc/localtime:/etc/localtime:ro"
|
||||||
|
- "kolla_logs:/var/log/kolla/"
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Database
|
# Database
|
||||||
####################
|
####################
|
||||||
|
84
ansible/roles/solum/handlers/main.yml
Normal file
84
ansible/roles/solum/handlers/main.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
---
|
||||||
|
- name: Restart solum-api container
|
||||||
|
vars:
|
||||||
|
service_name: "solum-api"
|
||||||
|
service: "{{ solum_services[service_name] }}"
|
||||||
|
config_json: "{{ solum_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_conf: "{{ solum_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_api_container: "{{ check_solum_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
kolla_docker:
|
||||||
|
action: "recreate_or_restart_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
name: "{{ service.container_name }}"
|
||||||
|
image: "{{ service.image }}"
|
||||||
|
volumes: "{{ service.volumes }}"
|
||||||
|
when:
|
||||||
|
- action != "config"
|
||||||
|
- inventory_hostname in groups[service.group]
|
||||||
|
- service.enabled | bool
|
||||||
|
- config_json.changed | bool
|
||||||
|
or solum_conf.changed | bool
|
||||||
|
or solum_api_container.changed | bool
|
||||||
|
|
||||||
|
- name: Restart solum-worker container
|
||||||
|
vars:
|
||||||
|
service_name: "solum-worker"
|
||||||
|
service: "{{ solum_services[service_name] }}"
|
||||||
|
config_json: "{{ solum_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_conf: "{{ solum_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_worker_container: "{{ check_solum_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
kolla_docker:
|
||||||
|
action: "recreate_or_restart_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
name: "{{ service.container_name }}"
|
||||||
|
image: "{{ service.image }}"
|
||||||
|
volumes: "{{ service.volumes }}"
|
||||||
|
when:
|
||||||
|
- action != "config"
|
||||||
|
- inventory_hostname in groups[service.group]
|
||||||
|
- service.enabled | bool
|
||||||
|
- config_json.changed | bool
|
||||||
|
or solum_conf.changed | bool
|
||||||
|
or solum_worker_container.changed | bool
|
||||||
|
|
||||||
|
- name: Restart solum-deployer container
|
||||||
|
vars:
|
||||||
|
service_name: "solum-deployer"
|
||||||
|
service: "{{ solum_services[service_name] }}"
|
||||||
|
config_json: "{{ solum_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_conf: "{{ solum_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_deployer_container: "{{ check_solum_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
kolla_docker:
|
||||||
|
action: "recreate_or_restart_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
name: "{{ service.container_name }}"
|
||||||
|
image: "{{ service.image }}"
|
||||||
|
volumes: "{{ service.volumes }}"
|
||||||
|
when:
|
||||||
|
- action != "config"
|
||||||
|
- inventory_hostname in groups[service.group]
|
||||||
|
- service.enabled | bool
|
||||||
|
- config_json.changed | bool
|
||||||
|
or solum_conf.changed | bool
|
||||||
|
or solum_deployer_container.changed | bool
|
||||||
|
|
||||||
|
- name: Restart solum-conductor container
|
||||||
|
vars:
|
||||||
|
service_name: "solum-conductor"
|
||||||
|
service: "{{ solum_services[service_name] }}"
|
||||||
|
config_json: "{{ solum_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_conf: "{{ solum_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
solum_conductor_container: "{{ check_solum_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
|
||||||
|
kolla_docker:
|
||||||
|
action: "recreate_or_restart_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
name: "{{ service.container_name }}"
|
||||||
|
image: "{{ service.image }}"
|
||||||
|
volumes: "{{ service.volumes }}"
|
||||||
|
when:
|
||||||
|
- action != "config"
|
||||||
|
- inventory_hostname in groups[service.group]
|
||||||
|
- service.enabled | bool
|
||||||
|
- config_json.changed | bool
|
||||||
|
or solum_conf.changed | bool
|
||||||
|
or solum_conductor_container.changed | bool
|
@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
- name: Running Solum bootstrap container
|
- name: Running Solum bootstrap container
|
||||||
|
vars:
|
||||||
|
solum_api: "{{ solum_services['solum-api'] }}"
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "start_container"
|
action: "start_container"
|
||||||
common_options: "{{ docker_common_options }}"
|
common_options: "{{ docker_common_options }}"
|
||||||
@ -7,14 +9,11 @@
|
|||||||
environment:
|
environment:
|
||||||
KOLLA_BOOTSTRAP:
|
KOLLA_BOOTSTRAP:
|
||||||
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
||||||
image: "{{ solum_api_image_full }}"
|
image: "{{ solum_api.image }}"
|
||||||
labels:
|
labels:
|
||||||
BOOTSTRAP:
|
BOOTSTRAP:
|
||||||
name: "bootstrap_solum"
|
name: "bootstrap_solum"
|
||||||
restart_policy: "never"
|
restart_policy: "never"
|
||||||
volumes:
|
volumes: "{{ solum_api.volumes }}"
|
||||||
- "{{ node_config_directory }}/solum-api/:{{ container_config_directory }}/:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
- "kolla_logs:/var/log/kolla/"
|
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['solum-api'][0] }}"
|
delegate_to: "{{ groups[solum_api.group][0] }}"
|
||||||
|
@ -1,40 +1,68 @@
|
|||||||
---
|
---
|
||||||
- name: Ensuring config directories exist
|
- name: Ensuring config directories exist
|
||||||
file:
|
file:
|
||||||
path: "{{ node_config_directory }}/{{ item }}"
|
path: "{{ node_config_directory }}/{{ item.key }}"
|
||||||
state: "directory"
|
state: "directory"
|
||||||
recurse: yes
|
recurse: yes
|
||||||
with_items:
|
when:
|
||||||
- "solum-api"
|
- inventory_hostname in groups[item.value.group]
|
||||||
- "solum-worker"
|
- item.value.enabled | bool
|
||||||
- "solum-deployer"
|
with_dict: "{{ solum_services }}"
|
||||||
- "solum-conductor"
|
|
||||||
|
|
||||||
- name: Copying over config.json files for services
|
- name: Copying over config.json files for services
|
||||||
template:
|
template:
|
||||||
src: "{{ item }}.json.j2"
|
src: "{{ item.key }}.json.j2"
|
||||||
dest: "{{ node_config_directory }}/{{ item }}/config.json"
|
dest: "{{ node_config_directory }}/{{ item.key }}/config.json"
|
||||||
with_items:
|
register: solum_config_jsons
|
||||||
- "solum-api"
|
when:
|
||||||
- "solum-worker"
|
- inventory_hostname in groups[item.value.group]
|
||||||
- "solum-deployer"
|
- item.value.enabled | bool
|
||||||
- "solum-conductor"
|
with_dict: "{{ solum_services }}"
|
||||||
|
notify:
|
||||||
|
- Restart solum-api container
|
||||||
|
- Restart solum-conductor container
|
||||||
|
- Restart solum-deployer container
|
||||||
|
- Restart solum-worker container
|
||||||
|
|
||||||
- name: Copying over solum.conf
|
- name: Copying over solum.conf
|
||||||
merge_configs:
|
merge_configs:
|
||||||
vars:
|
vars:
|
||||||
service_name: "{{ item }}"
|
service_name: "{{ item.key }}"
|
||||||
sources:
|
sources:
|
||||||
- "{{ role_path }}/templates/solum.conf.j2"
|
- "{{ role_path }}/templates/solum.conf.j2"
|
||||||
- "{{ node_config_directory }}/config/global.conf"
|
- "{{ node_config_directory }}/config/global.conf"
|
||||||
- "{{ node_config_directory }}/config/database.conf"
|
- "{{ node_config_directory }}/config/database.conf"
|
||||||
- "{{ node_config_directory }}/config/messaging.conf"
|
- "{{ node_config_directory }}/config/messaging.conf"
|
||||||
- "{{ node_config_directory }}/config/solum.conf"
|
- "{{ node_config_directory }}/config/solum.conf"
|
||||||
- "{{ node_config_directory }}/config/solum/{{ item }}.conf"
|
- "{{ node_config_directory }}/config/solum/{{ item.key }}.conf"
|
||||||
- "{{ node_config_directory }}/config/solum/{{ inventory_hostname }}/solum.conf"
|
- "{{ node_config_directory }}/config/solum/{{ inventory_hostname }}/solum.conf"
|
||||||
dest: "{{ node_config_directory }}/{{ item }}/solum.conf"
|
dest: "{{ node_config_directory }}/{{ item.key }}/solum.conf"
|
||||||
with_items:
|
register: solum_confs
|
||||||
- "solum-api"
|
when:
|
||||||
- "solum-worker"
|
- inventory_hostname in groups[item.value.group]
|
||||||
- "solum-deployer"
|
- item.value.enabled | bool
|
||||||
- "solum-conductor"
|
with_dict: "{{ solum_services }}"
|
||||||
|
notify:
|
||||||
|
- Restart solum-api container
|
||||||
|
- Restart solum-conductor container
|
||||||
|
- Restart solum-deployer container
|
||||||
|
- Restart solum-worker container
|
||||||
|
|
||||||
|
- name: Check solum containers
|
||||||
|
kolla_docker:
|
||||||
|
action: "compare_container"
|
||||||
|
common_options: "{{ docker_common_options }}"
|
||||||
|
name: "{{ item.value.container_name }}"
|
||||||
|
image: "{{ item.value.image }}"
|
||||||
|
volumes: "{{ item.value.volumes }}"
|
||||||
|
register: check_solum_containers
|
||||||
|
when:
|
||||||
|
- action != "config"
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
|
- item.value.enabled | bool
|
||||||
|
with_dict: "{{ solum_services }}"
|
||||||
|
notify:
|
||||||
|
- Restart solum-api container
|
||||||
|
- Restart solum-conductor container
|
||||||
|
- Restart solum-deployer container
|
||||||
|
- Restart solum-worker container
|
||||||
|
@ -11,8 +11,5 @@
|
|||||||
- include: bootstrap.yml
|
- include: bootstrap.yml
|
||||||
when: inventory_hostname in groups['solum-api']
|
when: inventory_hostname in groups['solum-api']
|
||||||
|
|
||||||
- include: start.yml
|
- name: Flush handlers
|
||||||
when: inventory_hostname in groups['solum-api'] or
|
meta: flush_handlers
|
||||||
inventory_hostname in groups['solum-deploy'] or
|
|
||||||
inventory_hostname in groups['solum-worker'] or
|
|
||||||
inventory_hostname in groups['solum-conductor']
|
|
||||||
|
@ -1,28 +1,10 @@
|
|||||||
---
|
---
|
||||||
- name: Pulling solum-api image
|
- name: Pulling solum images
|
||||||
kolla_docker:
|
kolla_docker:
|
||||||
action: "pull_image"
|
action: "pull_image"
|
||||||
common_options: "{{ docker_common_options }}"
|
common_options: "{{ docker_common_options }}"
|
||||||
image: "{{ solum_api_image_full }}"
|
image: "{{ item.value.image }}"
|
||||||
when: inventory_hostname in groups['solum-api']
|
when:
|
||||||
|
- inventory_hostname in groups[item.value.group]
|
||||||
- name: Pulling solum-worker image
|
- item.value.enabled | bool
|
||||||
kolla_docker:
|
with_dict: "{{ solum_services }}"
|
||||||
action: "pull_image"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_worker_image_full }}"
|
|
||||||
when: inventory_hostname in groups['solum-worker']
|
|
||||||
|
|
||||||
- name: Pulling solum-deployer image
|
|
||||||
kolla_docker:
|
|
||||||
action: "pull_image"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_deployer_image_full }}"
|
|
||||||
when: inventory_hostname in groups['solum-deployer']
|
|
||||||
|
|
||||||
- name: Pulling solum-conductor image
|
|
||||||
kolla_docker:
|
|
||||||
action: "pull_image"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_conductor_image_full }}"
|
|
||||||
when: inventory_hostname in groups['solum-conductor']
|
|
||||||
|
@ -1,76 +1,2 @@
|
|||||||
---
|
---
|
||||||
- name: Ensuring the containers up
|
- include: deploy.yml
|
||||||
kolla_docker:
|
|
||||||
name: "{{ item.name }}"
|
|
||||||
action: "get_container_state"
|
|
||||||
register: container_state
|
|
||||||
failed_when: container_state.Running == false
|
|
||||||
when: inventory_hostname in groups[item.group]
|
|
||||||
with_items:
|
|
||||||
- { name: solum_api, group: solum-api }
|
|
||||||
- { name: solum_worker, group: solum-worker }
|
|
||||||
- { name: solum_deployer, group: solum-deployer }
|
|
||||||
- { name: solum_conductor, group: solum-conductor }
|
|
||||||
|
|
||||||
- include: config.yml
|
|
||||||
|
|
||||||
- name: Check the configs
|
|
||||||
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
register: check_results
|
|
||||||
when: inventory_hostname in groups[item.group]
|
|
||||||
with_items:
|
|
||||||
- { name: solum_api, group: solum-api }
|
|
||||||
- { name: solum_worker, group: solum-worker }
|
|
||||||
- { name: solum_deployer, group: solum-deployer }
|
|
||||||
- { name: solum_conductor, group: solum-conductor }
|
|
||||||
|
|
||||||
- name: Containers config strategy
|
|
||||||
kolla_docker:
|
|
||||||
name: "{{ item.name }}"
|
|
||||||
action: "get_container_env"
|
|
||||||
register: container_envs
|
|
||||||
when: inventory_hostname in groups[item.group]
|
|
||||||
with_items:
|
|
||||||
- { name: solum_api, group: solum-api }
|
|
||||||
- { name: solum_worker, group: solum-worker }
|
|
||||||
- { name: solum_deployer, group: solum-deployer }
|
|
||||||
- { name: solum_conductor, group: solum-conductor }
|
|
||||||
|
|
||||||
- name: Remove the containers
|
|
||||||
kolla_docker:
|
|
||||||
name: "{{ item[0]['name'] }}"
|
|
||||||
action: "remove_container"
|
|
||||||
register: remove_containers
|
|
||||||
when:
|
|
||||||
- inventory_hostname in groups[item[0]['group']]
|
|
||||||
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
|
|
||||||
- item[2]['rc'] == 1
|
|
||||||
with_together:
|
|
||||||
- [{ name: solum_api, group: solum-api },
|
|
||||||
{ name: solum_worker, group: solum-worker },
|
|
||||||
{ name: solum_deployer, group: solum-deployer },
|
|
||||||
{ name: solum_conductor, group: solum-conductor }]
|
|
||||||
- "{{ container_envs.results }}"
|
|
||||||
- "{{ check_results.results }}"
|
|
||||||
|
|
||||||
- include: start.yml
|
|
||||||
when: remove_containers.changed
|
|
||||||
|
|
||||||
- name: Restart containers
|
|
||||||
kolla_docker:
|
|
||||||
name: "{{ item[0]['name'] }}"
|
|
||||||
action: "restart_container"
|
|
||||||
when:
|
|
||||||
- inventory_hostname in groups[item[0]['group']]
|
|
||||||
- config_strategy == 'COPY_ALWAYS'
|
|
||||||
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
|
|
||||||
- item[2]['rc'] == 1
|
|
||||||
with_together:
|
|
||||||
- [{ name: solum_api, group: solum-api },
|
|
||||||
{ name: solum_worker, group: solum-worker },
|
|
||||||
{ name: solum_deployer, group: solum-deployer },
|
|
||||||
{ name: solum_conductor, group: solum-conductor }]
|
|
||||||
- "{{ container_envs.results }}"
|
|
||||||
- "{{ check_results.results }}"
|
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
- name: Starting solum-worker container
|
|
||||||
kolla_docker:
|
|
||||||
action: "start_container"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_worker_image_full }}"
|
|
||||||
name: "solum_worker"
|
|
||||||
volumes:
|
|
||||||
- "{{ node_config_directory }}/solum-worker/:{{ container_config_directory }}/:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
- "kolla_logs:/var/log/kolla/"
|
|
||||||
when: inventory_hostname in groups['solum-worker']
|
|
||||||
|
|
||||||
- name: Starting solum-api container
|
|
||||||
kolla_docker:
|
|
||||||
action: "start_container"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_api_image_full }}"
|
|
||||||
name: "solum_api"
|
|
||||||
volumes:
|
|
||||||
- "{{ node_config_directory }}/solum-api/:{{ container_config_directory }}/:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
- "kolla_logs:/var/log/kolla/"
|
|
||||||
when: inventory_hostname in groups['solum-api']
|
|
||||||
|
|
||||||
- name: Starting solum-deployer container
|
|
||||||
kolla_docker:
|
|
||||||
action: "start_container"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_deployer_image_full }}"
|
|
||||||
name: "solum_deployer"
|
|
||||||
volumes:
|
|
||||||
- "{{ node_config_directory }}/solum-deployer/:{{ container_config_directory }}/:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
- "kolla_logs:/var/log/kolla/"
|
|
||||||
when: inventory_hostname in groups['solum-deployer']
|
|
||||||
|
|
||||||
- name: Starting solum-conductor container
|
|
||||||
kolla_docker:
|
|
||||||
action: "start_container"
|
|
||||||
common_options: "{{ docker_common_options }}"
|
|
||||||
image: "{{ solum_conductor_image_full }}"
|
|
||||||
name: "solum_conductor"
|
|
||||||
volumes:
|
|
||||||
- "{{ node_config_directory }}/solum-conductor/:{{ container_config_directory }}/:ro"
|
|
||||||
- "/etc/localtime:/etc/localtime:ro"
|
|
||||||
- "kolla_logs:/var/log/kolla/"
|
|
||||||
when: inventory_hostname in groups['solum-conductor']
|
|
@ -3,4 +3,5 @@
|
|||||||
|
|
||||||
- include: bootstrap_service.yml
|
- include: bootstrap_service.yml
|
||||||
|
|
||||||
- include: start.yml
|
- name: Flush handlers
|
||||||
|
meta: flush_handlers
|
||||||
|
Loading…
Reference in New Issue
Block a user