Merge "Ansible Neutron support"

This commit is contained in:
Jenkins 2015-07-21 21:50:33 +00:00 committed by Gerrit Code Review
commit 7302891206
26 changed files with 414 additions and 13 deletions

View File

@ -3,6 +3,9 @@
[support]
localhost ansible_connection=local
[network]
localhost ansible_connection=local
[compute]
localhost ansible_connection=local
@ -24,6 +27,8 @@ support
[nova:children]
support
[neutron:children]
network
# Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level.
@ -47,3 +52,10 @@ nova
[nova-scheduler:children]
nova
# Neutron
[neutron-server:children]
neutron
[neutron-agents:children]
neutron

View File

@ -0,0 +1,61 @@
---
project_name: "neutron"
####################
# Database
####################
neutron_database_name: "neutron"
neutron_database_user: "neutron"
neutron_database_address: "{{ kolla_internal_address }}"
# Do not override "service_*" variables
service_database_name: "{{ neutron_database_name }}"
service_database_user: "{{ neutron_database_user }}"
service_database_password: "{{ neutron_database_password }}"
####################
# Docker
####################
docker_neutron_registry: "{{ docker_registry }}"
docker_neutron_namespace: "{{ docker_namespace }}"
kolla_neutron_base_distro: "{{ kolla_base_distro }}"
kolla_neutron_install_type: "{{ kolla_install_type }}"
kolla_neutron_server_container_name: "neutron-server"
docker_neutron_server_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_server_container_name }}"
docker_neutron_server_tag: "{{ openstack_release }}"
docker_neutron_server_image_full: "{{ docker_neutron_server_image }}:{{ docker_neutron_server_tag }}"
kolla_neutron_agents_container_name: "neutron-agents"
docker_neutron_agents_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_agents_container_name }}"
docker_neutron_agents_tag: "{{ openstack_release }}"
docker_neutron_agents_image_full: "{{ docker_neutron_agents_image }}:{{ docker_neutron_agents_tag }}"
kolla_neutron_openvswitch_agent_container_name: "neutron-openvswitch-agent"
docker_neutron_openvswitch_agent_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_openvswitch_agent_container_name }}"
docker_neutron_openvswitch_agent_tag: "{{ openstack_release }}"
docker_neutron_openvswitch_agent_image_full: "{{ docker_neutron_openvswitch_agent_image }}:{{ docker_neutron_openvswitch_agent_tag }}"
kolla_openvswitch_db_container_name: "ovs-db-server"
docker_openvswitch_db_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_openvswitch_db_container_name }}"
docker_openvswitch_db_tag: "{{ openstack_release }}"
docker_openvswitch_db_image_full: "{{ docker_openvswitch_db_image }}:{{ docker_openvswitch_db_tag }}"
kolla_openvswitch_vswitchd_container_name: "ovs-vswitchd"
docker_openvswitch_vswitchd_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_openvswitch_vswitchd_container_name }}"
docker_openvswitch_vswitchd_tag: "{{ openstack_release }}"
docker_openvswitch_vswitchd_image_full: "{{ docker_openvswitch_vswitchd_image }}:{{ docker_openvswitch_vswitchd_tag }}"
####################
# Openstack
####################
neutron_public_address: "{{ kolla_external_address }}"
neutron_admin_address: "{{ kolla_internal_address }}"
neutron_internal_address: "{{ kolla_internal_address }}"
neutron_logging_verbose: "{{ openstack_logging_verbose }}"
neutron_logging_debug: "{{ openstack_logging_debug }}"
neutron_keystone_user: "neutron"

View File

@ -0,0 +1,12 @@
---
- include: ../../bootstrap.yml
vars:
container_detach: False
container_environment:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_server_image_full }}"
container_name: "bootstrap_neutron"
container_restart_policy: "no"
container_volumes:
- "{{ node_config_directory }}/neutron-server/:/opt/kolla/neutron-server/:ro"

View File

@ -0,0 +1,74 @@
---
- include: ../../config.yml
vars:
service_name: "neutron-server"
config_source:
- "roles/{{ project_name }}/templates/neutron.conf.j2"
- "/etc/kolla/config/global.conf"
- "/etc/kolla/config/database.conf"
- "/etc/kolla/config/messaging.conf"
- "/etc/kolla/config/{{ project_name }}.conf"
- "/etc/kolla/config/{{ project_name }}/{{ service_name }}.conf"
config_template_dest:
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_minimal"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_global"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_database"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_messaging"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_augment"
- "{{ node_templates_directory }}/{{ service_name }}/{{ service_name }}.conf_augment"
config_dest: "{{ node_config_directory }}/{{ service_name }}/neutron.conf"
when: inventory_hostname in groups['neutron-server']
- include: ../../config.yml
vars:
service_name: "neutron-agents"
config_source:
- "roles/{{ project_name }}/templates/neutron.conf.j2"
- "/etc/kolla/config/global.conf"
- "/etc/kolla/config/database.conf"
- "/etc/kolla/config/messaging.conf"
- "/etc/kolla/config/{{ project_name }}.conf"
- "/etc/kolla/config/{{ project_name }}/{{ service_name }}.conf"
config_template_dest:
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_minimal"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_global"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_database"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_messaging"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_augment"
- "{{ node_templates_directory }}/{{ service_name }}/{{ service_name }}.conf_augment"
config_dest: "{{ node_config_directory }}/{{ service_name }}/neutron.conf"
when: inventory_hostname in groups['neutron-agents']
- include: ../../config.yml
vars:
service_name: "neutron-openvswitch-agent"
config_source:
- "roles/{{ project_name }}/templates/neutron.conf.j2"
- "/etc/kolla/config/global.conf"
- "/etc/kolla/config/database.conf"
- "/etc/kolla/config/messaging.conf"
- "/etc/kolla/config/{{ project_name }}.conf"
- "/etc/kolla/config/{{ project_name }}/{{ service_name }}.conf"
config_template_dest:
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_minimal"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_global"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_database"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_messaging"
- "{{ node_templates_directory }}/{{ service_name }}/{{ project_name }}.conf_augment"
- "{{ node_templates_directory }}/{{ service_name }}/{{ service_name }}.conf_augment"
config_dest: "{{ node_config_directory }}/{{ service_name }}/neutron.conf"
when: inventory_hostname in groups['neutron-agents'] or
inventory_hostname in groups['compute']
- include: ../../config.yml
vars:
service_name: "neutron-openvswitch-agent"
config_source:
- "roles/{{ project_name }}/templates/ml2_conf.ini.j2"
- "/etc/kolla/config/{{ project_name }}/ml2_conf.ini"
config_template_dest:
- "{{ node_templates_directory }}/{{ service_name }}/ml2_conf.ini_minimal"
- "{{ node_templates_directory }}/{{ service_name }}/ml2_conf.ini_augment"
config_dest: "{{ node_config_directory }}/ml2_conf.ini"
when: inventory_hostname in groups['neutron-agents'] or
inventory_hostname in groups['compute']

View File

@ -0,0 +1,8 @@
---
- include: register.yml
- include: config.yml
- include: bootstrap.yml
- include: start.yml

View File

@ -0,0 +1,21 @@
---
- name: Creating the Neutron service and endpoint
kolla_keystone_service:
service_name: "neutron"
service_type: "network"
description: "OpenStack Networking"
endpoint_region: "{{ openstack_region_name }}"
admin_url: "http://{{ kolla_internal_address }}:{{ neutron_server_port }}"
internal_url: "http://{{ kolla_internal_address }}:{{ neutron_server_port }}"
public_url: "http://{{ kolla_external_address }}:{{ neutron_server_port }}"
auth: "{{ openstack_auth_v2 }}"
region_name: "{{ openstack_region_name }}"
- name: Creating the Neutron project, user, and role
kolla_keystone_user:
project: "service"
user: "neutron"
password: "{{ neutron_keystone_password }}"
role: "admin"
auth: "{{ openstack_auth_v2 }}"
region_name: "{{ openstack_region_name }}"

View File

@ -0,0 +1,59 @@
---
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_openvswitch_db_image_full }}"
container_name: "openvswitch_db"
container_volumes:
- "/run:/run"
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['neutron-agents']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_openvswitch_vswitchd_image_full }}"
container_name: "openvswitch_vswitchd"
container_privileged: "True"
container_volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['neutron-agents']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_openvswitch_agent_image_full }}"
container_name: "neutron_openvswitch_agent"
container_privileged: "True"
container_volumes:
- "/run:/run"
- "{{ node_config_directory }}/neutron-openvswitch-agent/:/opt/kolla/neutron-openvswitch-agent/:ro"
when: inventory_hostname in groups['compute'] or
inventory_hostname in groups['neutron-agents']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_agents_image_full }}"
container_name: "neutron_agents"
container_privileged: "True"
container_volumes:
- "{{ node_config_directory }}/neutron-agents/:/opt/kolla/neutron-agents/:ro"
when: inventory_hostname in groups['neutron-agents']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_server_image_full }}"
container_name: "neutron_server"
container_privileged: "True"
container_volumes:
- "{{ node_config_directory }}/neutron-server/:/opt/kolla/neutron-server/:ro"
when: inventory_hostname in groups['neutron-server']

View File

@ -0,0 +1,4 @@
[DEFAULT]
# DHCP Agent
dnsmasq_config_file = /etc/neutron/dnsmasq.conf
dhcp_delete_namespaces = true

View File

@ -0,0 +1,8 @@
[DEFAULT]
# L3 Agent
router_delete_namespaces = true
#router_distributed = true
enable_metadata_proxy = true
agent_mode = legacy
external_network_bridge = br-ex
#ha_vrrp_auth_password = c0b4e8f922a7b03d1def93b516da81d8103c83c2

View File

@ -0,0 +1,26 @@
[DEFAULT]
nova_metadata_ip = {{ kolla_internal_address }}
metadata_proxy_shared_secret = {{ metadata_secret }}
auth_uri = http://{{ kolla_internal_address }}:{{ keystone_public_port }}
auth_url = http://{{ kolla_internal_address }}:{{ keystone_admin_port }}
auth_region = {{ openstack_region_name }}
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = {{ neutron_keystone_password }}
nova_url = http://{{ kolla_internal_address }}:{{ nova_api_port }}/v2
notify_nova_on_port_data_changes = True
notify_nova_on_port_status_change = True
[nova]
auth_url = http://{{ kolla_internal_address }}:{{ keystone_admin_port }}
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = {{ openstack_region_name }}
project_name = service
username = nova
password = {{ nova_keystone_password }}

View File

@ -0,0 +1,35 @@
# TODO(SamYaple): Make entire file more configurable configurable
[ml2]
# Changing type_drivers after bootstrap can lead to database inconsistencies
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = openvswitch,l2population
[ml2_type_vlan]
network_vlan_ranges = external:1000:1999
[ml2_type_flat]
#flat_networks = external
[ml2_type_gre]
tunnel_id_ranges = 1:1000
[ml2_type_vxlan]
vni_ranges = 1:1000
vxlan_group = 239.1.1.1
[securitygroup]
firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver
enable_ipset = true
enable_security_group = true
[agent]
tunnel_types = vxlan
l2_population = true
arp_responder = true
#enable_distributed_routing = true
[ovs]
local_ip = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
bridge_mappings = external:{{ neutron_interface }}

View File

@ -0,0 +1,38 @@
[DEFAULT]
verbose = true
debug = true
bind_host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }}
lock_path = /var/lock/neutron
api_paste_config = /usr/share/neutron/api-paste.ini
notification_driver = neutron.openstack.common.notifier.rpc_notifier
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
allow_overlapping_ips = true
core_plugin = ml2
service_plugins = router
[oslo_messaging_rabbit]
rabbit_host = {{ kolla_internal_address }}
rabbit_userid = {{ rabbitmq_user }}
rabbit_password = {{ rabbitmq_password }}
rabbit_ha_queues = true
[agent]
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
[database]
connection = mysql://{{ neutron_database_user }}:{{ neutron_database_password }}@{{ neutron_database_address }}/{{ neutron_database_name }}
[keystone_authtoken]
auth_uri = http://{{ kolla_internal_address }}:{{ keystone_public_port }}
auth_url = http://{{ kolla_internal_address }}:{{ keystone_admin_port }}
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = {{ neutron_keystone_password }}

View File

@ -19,7 +19,16 @@
- glance
tags: glance
- hosts: nova
- hosts:
- nova
- compute
roles:
- nova
tags: nova
- hosts:
- neutron
- compute
roles:
- neutron
tags: neutron

View File

@ -2,7 +2,7 @@
set -o errexit
CMD="/usr/bin/neutron-dhcp-agent"
ARGS="--config-file /etc/neutron/dhcp_agent.ini --config-dir /etc/neutron"
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini"
# Loading common functions.
source /opt/kolla/kolla-common.sh
@ -16,14 +16,14 @@ set_configs() {
exec /opt/kolla/neutron-dhcp-agent/config-internal.sh
;;
CONFIG_EXTERNAL_COPY_ALWAYS)
source /opt/kolla/neutron-dhcp-agent/config-exernal.sh
source /opt/kolla/neutron-dhcp-agent/config-external.sh
;;
CONFIG_EXTERNAL_COPY_ONCE)
if [[ -f /configured-dhcp ]]; then
echo 'INFO - Neutron-dhcp has already been configured; Refusing to copy new configs'
return
fi
source /opt/kolla/neutron-dhcp-agent/config-exernal.sh
source /opt/kolla/neutron-dhcp-agent/config-external.sh
touch /configured-dhcp
;;

View File

@ -1,5 +1,5 @@
#!/bin/bash
SOURCES="/opt/kolla/neutron-l3-agent/neutron.conf /opt/kolla/neutron-l3-agent/l3_agent.ini /opt/kolla/neutron-l3-agent/fwaas_driver.ini"
SOURCES="/opt/kolla/neutron-agents/neutron.conf /opt/kolla/neutron-agents/l3_agent.ini /opt/kolla/neutron-agents/fwaas_driver.ini"
TARGET="/etc/neutron/"
OWNER="neutron"
@ -11,3 +11,13 @@ for f in $SOURCES; do
chmod 0644 $TARGET/$fname
fi
done
SOURCE="/opt/kolla/neutron-agents/ml2_conf.ini"
TARGET="/etc/neutron/plugins/ml2/ml2_conf.ini"
OWNER="neutron"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -2,7 +2,7 @@
set -o errexit
CMD="/usr/bin/neutron-l3-agent"
ARGS="--config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini --config-dir /etc/neutron"
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini --config-file /etc/neutron/fwaas_driver.ini --config-file /etc/neutron/plugins/ml2/ml2_conf.ini"
# Loading common functions.
source /opt/kolla/kolla-common.sh
@ -16,14 +16,14 @@ set_configs() {
exec /opt/kolla/neutron-l3-agent/config-internal.sh
;;
CONFIG_EXTERNAL_COPY_ALWAYS)
source /opt/kolla/neutron-l3-agent/config-exernal.sh
source /opt/kolla/neutron-l3-agent/config-external.sh
;;
CONFIG_EXTERNAL_COPY_ONCE)
if [[ -f /configured-l3 ]]; then
echo 'INFO - Neutron-l3 has already been configured; Refusing to copy new configs'
return
fi
source /opt/kolla/neutron-l3-agent/config-exernal.sh
source /opt/kolla/neutron-l3-agent/config-external.sh
touch /configured-l3
;;

View File

@ -2,7 +2,7 @@
set -o errexit
CMD="/usr/bin/neutron-metadata-agent"
ARGS="--config-file /etc/neutron/metadata_agent.ini --config-dir /etc/neutron"
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini"
# Loading common functions.
source /opt/kolla/kolla-common.sh
@ -16,14 +16,14 @@ set_configs() {
exec /opt/kolla/neutron-metadata-agent/config-internal.sh
;;
CONFIG_EXTERNAL_COPY_ALWAYS)
source /opt/kolla/neutron-metadata-agent/config-exernal.sh
source /opt/kolla/neutron-metadata-agent/config-external.sh
;;
CONFIG_EXTERNAL_COPY_ONCE)
if [[ -f /configured-md ]]; then
echo 'INFO - Neutron-metadata has already been configured; Refusing to copy new configs'
return
fi
source /opt/kolla/neutron-metadata-agent/config-exernal.sh
source /opt/kolla/neutron-metadata-agent/config-external.sh
touch /configured-md
;;

View File

@ -8,3 +8,13 @@ if [[ -f "$SOURCE" ]]; then
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi
SOURCE="/opt/kolla/neutron-openvswitch-agent/ml2_conf.ini"
TARGET="/etc/neutron/plugins/ml2/ml2_conf.ini"
OWNER="neutron"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -2,7 +2,7 @@
set -o errexit
CMD="/usr/bin/neutron-openvswitch-agent"
ARGS="--config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
ARGS="--config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini"
# Loading common functions.
source /opt/kolla/kolla-common.sh
@ -10,4 +10,7 @@ source /opt/kolla/kolla-common.sh
# Config-internal script exec out of this function, it does not return here.
set_configs
# Set !requiretty
source /opt/kolla/config-sudoers.sh
exec $CMD $ARGS

View File

@ -8,3 +8,14 @@ if [[ -f "$SOURCE" ]]; then
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi
# TODO(SamYaple): Remove this from neutron-server once bootstrap is understood
SOURCE="/opt/kolla/neutron-openvswitch-agent/ml2_conf.ini"
TARGET="/etc/neutron/plugins/ml2/ml2_conf.ini"
OWNER="neutron"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -2,7 +2,7 @@
set -o errexit
CMD="/usr/bin/neutron-server"
ARGS="--config-file /etc/neutron/plugins/ml2/ml2_conf.ini"
ARGS="--config-file /etc/neutron/neutron.conf"
# Loading common functions.
source /opt/kolla/kolla-common.sh

View File

View File