kolla-ansible/ansible/roles/cyborg/handlers/main.yml
白永君 4bdb0f3570 Change action to kolla_action
the action show be kolla_action in kolla-ansible/cyborg
Closes-bug: #1822555
Change-Id: I3dd909ae785dd43d5faabbc3fdd5f8bb8aca370b
2019-04-01 18:03:47 +08:00

73 lines
3.3 KiB
YAML

---
- name: Restart cyborg-api container
vars:
service_name: "cyborg-api"
service: "{{ cyborg_services[service_name] }}"
config_json: "{{ cyborg_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cyborg_conf: "{{ cyborg_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ cyborg_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
cyborg_api_container: "{{ check_cyborg_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 }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or cyborg_conf.changed | bool
or policy_overwriting.changed | bool
or cyborg_api_container.changed | bool
- name: Restart cyborg-conductor container
vars:
service_name: "cyborg-conductor"
service: "{{ cyborg_services[service_name] }}"
config_json: "{{ cyborg_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cyborg_conf: "{{ cyborg_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ cyborg_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
cyborg_conductor_container: "{{ check_cyborg_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 }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or cyborg_conf.changed | bool
or policy_overwriting.changed | bool
or cyborg_conductor_container.changed | bool
- name: Restart cyborg-agent container
vars:
service_name: "cyborg-agent"
service: "{{ cyborg_services[service_name] }}"
config_json: "{{ cyborg_config_jsons.results|selectattr('item.key', 'equalto', service_name)|first }}"
cyborg_conf: "{{ cyborg_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ cyborg_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
cyborg_agent_container: "{{ check_cyborg_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 }}"
dimensions: "{{ service.dimensions }}"
when:
- kolla_action != "config"
- inventory_hostname in groups[service.group]
- service.enabled | bool
- config_json.changed | bool
or cyborg_conf.changed | bool
or policy_overwriting.changed | bool
or cyborg_agent_container.changed | bool