kayobe/ansible/kolla-openstack.yml
2017-06-07 16:37:48 +01:00

99 lines
4.8 KiB
YAML

---
- name: Ensure Kolla OpenStack components are configured
hosts: config-mgmt
vars:
switch_type_to_device_type:
dellos9: netmiko_dell_force10
pre_tasks:
- block:
- name: Check whether Kolla extra configuration files exist
stat:
path: "{{ kayobe_config_path }}/kolla/config/{{ item.file }}"
get_checksum: False
get_md5: False
mime: False
register: stat_result
with_items:
- { name: glance, file: glance.conf }
- { name: inspector, file: ironic-inspector.conf }
- { name: ironic, file: ironic.conf }
- { name: magnum, file: magnum.conf }
- { name: neutron, file: neutron.conf }
- { name: neutron_ml2, file: neutron/ml2_conf.ini }
- { name: nova, file: nova.conf }
- { name: sahara, file: sahara.conf }
- name: Initialise a fact containing extra configuration
set_fact:
kolla_extra_config: {}
- name: Update a fact containing extra configuration
set_fact:
kolla_extra_config: "{{ kolla_extra_config | combine({item.item.name: lookup('template', '{{ item.stat.path }}')}) }}"
with_items: "{{ stat_result.results }}"
when: "{{ item.stat.exists }}"
- name: Validate switch configuration for Neutron ML2 genericswitch driver
fail:
msg: >
Switch configuration for {{ item }} is invalid. The following
variables must be set for the host: switch_type, ansible_host,
ansible_user, ansible_ssh_pass. Further, switch_type must be one of
{{ switch_type_to_device_type.keys() | join(', ') }}.
with_items: "{{ kolla_neutron_ml2_generic_switch_hosts }}"
when: >
{{
item not in hostvars or
'switch_type' not in hostvars[item] or
hostvars[item].switch_type not in switch_type_to_device_type or
'ansible_host' not in hostvars[item] or
'ansible_user' not in hostvars[item] or
'ansible_ssh_pass' not in hostvars[item]
}}
tags:
- config-validation
- name: Update a fact containing switches for use by Neutron ML2 genericswitch driver
set_fact:
kolla_neutron_ml2_generic_switches: >
{{
kolla_neutron_ml2_generic_switches +
[{
'name': item,
'device_type': switch_type_to_device_type[hostvars[item].switch_type],
'ip': hostvars[item].ansible_host,
'username': hostvars[item].ansible_user,
'password': hostvars[item].ansible_ssh_pass,
'ngs_trunk_ports': (
hostvars[item].switch_interface_config |
switch_interface_config_select_description(kolla_neutron_ml2_generic_switch_trunk_port_hosts)).keys() | join(',')
}]
}}
with_items: "{{ kolla_neutron_ml2_generic_switch_hosts }}"
tags:
- config
roles:
- role: kolla-openstack
# Ironic inspector configuration.
kolla_inspector_manage_firewall: "{{ inspector_manage_firewall }}"
kolla_inspector_processing_hooks: "{{ inspector_processing_hooks }}"
kolla_inspector_add_ports: "{{ inspector_add_ports }}"
kolla_inspector_keep_ports: "{{ inspector_keep_ports }}"
kolla_inspector_enable_discovery: "{{ inspector_enable_discovery }}"
kolla_inspector_discovery_enroll_node_driver: "{{ inspector_discovery_enroll_node_driver }}"
kolla_inspector_extra_kernel_options: "{{ inspector_extra_kernel_options }}"
kolla_inspector_ipa_kernel_upstream_url: "{{ inspector_ipa_kernel_upstream_url }}"
kolla_inspector_ipa_ramdisk_upstream_url: "{{ inspector_ipa_ramdisk_upstream_url }}"
# Ironic inspector's dnsmasq configuration.
kolla_inspector_dhcp_pool_start: "{{ inspection_net_name | net_inspection_allocation_pool_start }}"
kolla_inspector_dhcp_pool_end: "{{ inspection_net_name | net_inspection_allocation_pool_end }}"
# Extra free-form user-provided configuration.
kolla_extra_glance: "{{ kolla_extra_config.glance | default }}"
kolla_extra_inspector: "{{ kolla_extra_config.inspector | default }}"
kolla_extra_ironic: "{{ kolla_extra_config.ironic | default }}"
kolla_extra_magnum: "{{ kolla_extra_config.magnum | default }}"
kolla_extra_neutron: "{{ kolla_extra_config.neutron | default }}"
kolla_extra_neutron_ml2: "{{ kolla_extra_config.neutron_ml2 | default }}"
kolla_extra_nova: "{{ kolla_extra_config.nova | default }}"
kolla_extra_sahara: "{{ kolla_extra_config.sahara | default }}"