kolla-ansible/ansible/roles/horizon/tasks/config.yml
caoyuan 1c3c611f40 Add the missing condition for config.yml
- add "item.value.enabled | bool"
- add "| bool" to keystone
- add group check for searchlight

Change-Id: Id4555a0a96ea1670e99c88a1da9d3e07bf253497
2017-02-14 11:19:26 +08:00

123 lines
4.4 KiB
YAML

---
- name: Ensuring config directories exist
file:
path: "{{ node_config_directory }}/{{ item.key }}"
state: "directory"
recurse: yes
when:
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ horizon_services }}"
- name: Copying over config.json files for services
vars:
horizon: "{{ horizon_services['horizon'] }}"
template:
src: "horizon.json.j2"
dest: "{{ node_config_directory }}/horizon/config.json"
register: horizon_config_json
when:
- horizon.enabled | bool
- inventory_hostname in groups[horizon.group]
notify:
- Restart horizon container
- name: Copying over horizon.conf
vars:
horizon: "{{ horizon_services['horizon'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/horizon/horizon.conf"
register: horizon_conf
with_first_found:
- "{{ node_custom_config }}/horizon/{{ inventory_hostname }}/horizon.conf"
- "{{ node_custom_config }}/horizon/horizon.conf"
- "horizon.conf.j2"
when:
- horizon.enabled | bool
- inventory_hostname in groups[horizon.group]
notify:
- Restart horizon container
- name: Copying over local_settings
vars:
horizon: "{{ horizon_services['horizon'] }}"
template:
src: "{{ item }}"
dest: "{{ node_config_directory }}/horizon/local_settings"
with_first_found:
- "{{ node_custom_config }}/horizon/{{ inventory_hostname }}/local_settings"
- "{{ node_custom_config }}/horizon/local_settings"
- "local_settings.j2"
register: horizon_local_settings
when:
- horizon.enabled | bool
- inventory_hostname in groups[horizon.group]
notify:
- Restart horizon container
- name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/horizon/{{ item.name }}_policy.json"
register: custom_policy
when: item.enabled | bool
with_items:
- { name: "ceilometer", enabled: "{{ enable_ceilometer }}" }
- { name: "cinder", enabled: "{{ enable_cinder }}" }
- { name: "cloudkitty", enabled: "{{ enable_cloudkitty }}" }
- { name: "glance", enabled: "{{ enable_glance }}" }
- { name: "heat", enabled: "{{ enable_heat }}" }
- { name: "ironic", enabled: "{{ enable_ironic }}" }
- { name: "keystone", enabled: "{{ enable_keystone }}" }
- { name: "manila", enabled: "{{ enable_manila }}" }
- { name: "neutron", enabled: "{{ enable_neutron }}" }
- { name: "nova", enabled: "{{ enable_nova }}" }
- { name: "sahara", enabled: "{{ enable_sahara }}" }
- { name: "senlin", enabled: "{{ enable_senlin }}" }
- { name: "trove", enabled: "{{ enable_trove }}" }
- name: Copying over existing policy.json
vars:
horizon: "{{ horizon_services['horizon'] }}"
template:
src: "{{ node_custom_config }}/horizon/{{ item[0]['name'] }}_policy.json"
dest: "{{ node_config_directory }}/horizon/{{ item[0]['name'] }}_policy.json"
register: policy_jsons
when:
- horizon.enabled | bool
- inventory_hostname in groups[horizon.group]
- item[0]['enabled'] | bool
- item[1]['stat']['exists']
with_together:
- [{ name: "ceilometer", enabled: "{{ enable_ceilometer }}" },
{ name: "cinder", enabled: "{{ enable_cinder }}" },
{ name: "cloudkitty", enabled: "{{ enable_cloudkitty }}" },
{ name: "glance", enabled: "{{ enable_glance }}" },
{ name: "heat", enabled: "{{ enable_heat }}" },
{ name: "ironic", enabled: "{{ enable_ironic }}" },
{ name: "keystone", enabled: "{{ enable_keystone }}" },
{ name: "manila", enabled: "{{ enable_manila }}" },
{ name: "neutron", enabled: "{{ enable_neutron }}" },
{ name: "nova", enabled: "{{ enable_nova }}" },
{ name: "sahara", enabled: "{{ enable_sahara }}" },
{ name: "senlin", enabled: "{{ enable_senlin }}" },
{ name: "trove", enabled: "{{ enable_trove }}" }]
- "{{ custom_policy.results }}"
- name: Check horizon container
vars:
horizon: "{{ horizon_services['horizon'] }}"
kolla_docker:
action: "compare_container"
common_options: "{{ docker_common_options }}"
name: "{{ horizon.container_name }}"
image: "{{ horizon.image }}"
environment: "{{ horizon.environment }}"
volumes: "{{ horizon.volumes }}"
register: check_horizon_container
when:
- action != "config"
- inventory_hostname in groups[horizon.group]
- horizon.enabled | bool
notify:
- Restart horizon container