Merge pull request #114 from stackhpc/feature/set_api_interface_per_host

Support configuring API interface via overcloud inventory file
This commit is contained in:
Doug Szumski 2018-01-23 11:43:15 +00:00 committed by GitHub
commit 1764dd8393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 8 deletions

View File

@ -1,4 +1,29 @@
---
- name: Set interfaces for overcloud hosts
hosts: overcloud
tags:
- config
- kolla-ansible
gather_facts: False
tasks:
- name: Set API interface
set_fact:
kolla_api_interface: "{{ internal_net_name | net_interface | replace('-', '_') }}"
when: internal_net_name in network_interfaces
- name: Validate overcloud host Kolla Ansible network configuration
fail:
msg: >
The Kolla Ansible variable {{ item.var_name }}
({{ item.description }}) is invalid. Value:
"{{ hostvars[inventory_hostname][item.var_name] | default('<undefined>') }}".
when:
- item.required | bool
- hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name]
with_items:
- var_name: "kolla_api_interface"
description: "API network interface name"
required: True
- name: Ensure Kolla Ansible is configured
hosts: localhost
tags:
@ -35,7 +60,6 @@
- name: Set facts containing the controller network interfaces
set_fact:
kolla_network_interface: "{{ internal_net_name | net_interface(controller_host) | replace('-', '_') }}"
kolla_api_interface: "{{ internal_net_name | net_interface(controller_host) | replace('-', '_') }}"
kolla_storage_interface: "{{ storage_net_name | net_interface(controller_host) | replace('-', '_') }}"
kolla_cluster_interface: "{{ storage_mgmt_net_name | net_interface(controller_host) | replace('-', '_') }}"
kolla_provision_interface: "{{ provision_wl_net_name | net_interface(controller_host) | replace('-', '_') }}"
@ -52,9 +76,6 @@
- item.required | bool
- hostvars[inventory_hostname][item.var_name] is not defined or not hostvars[inventory_hostname][item.var_name]
with_items:
- var_name: "kolla_api_interface"
description: "API network interface name"
required: True
- var_name: "kolla_provision_interface"
description: "Bare metal provisioning network interface name"
required: "{{ kolla_enable_ironic }}"

View File

@ -69,6 +69,7 @@ kolla_overcloud_inventory_pass_through_host_vars:
- "ansible_host"
- "ansible_port"
- "ansible_ssh_private_key_file"
- "kolla_api_interface"
###############################################################################
# Kolla-ansible global configuration options.

View File

@ -76,12 +76,17 @@ docker_registry_password: "{{ kolla_docker_registry_password }}"
# Yet another way to workaround the naming problem is to create a bond for the
# interface on all hosts and give the bond name here. Similar strategy can be
# followed for other types of interfaces.
#
# NOTE: The following interfaces are configured via the inventory and are
# therefore not set here:
#
# - api_interface
network_interface: "{{ kolla_network_interface }}"
# These can be adjusted for even more customization. The default is the same as
# the 'network_interface'. These interfaces must contain an IPv4 address.
kolla_external_vip_interface: "{{ kolla_external_vip_interface }}"
api_interface: "{{ kolla_api_interface }}"
storage_interface: "{{ kolla_storage_interface }}"
cluster_interface: "{{ kolla_cluster_interface }}"
dns_interface: "{{ kolla_dns_interface }}"

View File

@ -17,7 +17,7 @@
# These hostnames must be resolvable from your deployment host
{% for host in groups.get(group, []) %}
{% set host_hv=hostvars[host] %}
{{ host }}{% for hv_name in kolla_overcloud_inventory_pass_through_host_vars %}{% if hv_name in host_hv %} {{ hv_name }}={{ host_hv[hv_name] }}{% endif %}{% endfor %}
{{ host }}{% for hv_name in kolla_overcloud_inventory_pass_through_host_vars %}{% if hv_name in host_hv %} {{ hv_name | regex_replace('^kolla_(.*)$', '\1') }}={{ host_hv[hv_name] }}{% endif %}{% endfor %}
{% endfor %}

View File

@ -83,7 +83,6 @@
docker_namespace: "fake-namespace"
network_interface: "eth0"
kolla_external_vip_interface: "eth1"
api_interface: "eth2"
storage_interface: "eth3"
cluster_interface: "eth4"
dns_interface: "eth5"

View File

@ -174,7 +174,6 @@
docker_registry_password: "fake-password"
network_interface: "eth0"
kolla_external_vip_interface: "eth1"
api_interface: "eth2"
storage_interface: "eth3"
cluster_interface: "eth4"
dns_interface: "eth5"