Convert existing roles into galaxy roles
This change implements the blueprint to convert all roles and plays into a more generic setup, following upstream ansible best practices. Items Changed: * All tasks have tags. * All roles use namespaced variables. * All redundant tasks within a given play and role have been removed. * All of the repetitive plays have been removed in-favor of a more simplistic approach. This change duplicates code within the roles but ensures that the roles only ever run within their own scope. * All roles have been built using an ansible galaxy syntax. * The `*requirement.txt` files have been reformatted follow upstream Openstack practices. * Dynamically generated inventory is now more organized, this should assist anyone who may want or need to dive into the JSON blob that is created. In the inventory a properties field is used for items that customize containers within the inventory. * The environment map has been modified to support additional host groups to enable the seperation of infrastructure pieces. While the old infra_hosts group will still work this change allows for groups to be divided up into seperate chunks; eg: deployment of a swift only stack. * The LXC logic now exists within the plays. * etc/openstack_deploy/user_variables.yml has all password/token variables extracted into the separate file etc/openstack_deploy/user_secrets.yml in order to allow seperate security settings on that file. Items Excised: * All of the roles have had the LXC logic removed from within them which should allow roles to be consumed outside of the `os-ansible-deployment` reference architecture. Note: * the directory rpc_deployment still exists and is presently pointed at plays containing a deprecation warning instructing the user to move to the standard playbooks directory. * While all of the rackspace specific components and variables have been removed and or were refactored the repository still relies on an upstream mirror of Openstack built python files and container images. This upstream mirror is hosted at rackspace at "http://rpc-repo.rackspace.com" though this is not locked to and or tied to rackspace specific installations. This repository contains all of the needed code to create and/or clone your own mirror. DocImpact Co-Authored-By: Jesse Pretorius <jesse.pretorius@rackspace.co.uk> Closes-Bug: #1403676 Implements: blueprint galaxy-roles Change-Id: I03df3328b7655f0cc9e43ba83b02623d038d214e
This commit is contained in:
commit
ae6e53bd04
85
CONTRIBUTING.rst
Normal file
85
CONTRIBUTING.rst
Normal file
@ -0,0 +1,85 @@
|
||||
OpenStack neutron
|
||||
#################
|
||||
:tags: openstack, neutron, cloud, ansible
|
||||
:category: \*nix
|
||||
|
||||
contributor guidelines
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Filing Bugs
|
||||
-----------
|
||||
|
||||
Bugs should be filed on Launchpad, not GitHub: "https://bugs.launchpad.net/openstack-ansible"
|
||||
|
||||
|
||||
When submitting a bug, or working on a bug, please ensure the following criteria are met:
|
||||
* The description clearly states or describes the original problem or root cause of the problem.
|
||||
* Include historical information on how the problem was identified.
|
||||
* Any relevant logs are included.
|
||||
* The provided information should be totally self-contained. External access to web services/sites should not be needed.
|
||||
* Steps to reproduce the problem if possible.
|
||||
|
||||
|
||||
Submitting Code
|
||||
---------------
|
||||
|
||||
Changes to the project should be submitted for review via the Gerrit tool, following
|
||||
the workflow documented at: "http://docs.openstack.org/infra/manual/developers.html#development-workflow"
|
||||
|
||||
Pull requests submitted through GitHub will be ignored and closed without regard.
|
||||
|
||||
|
||||
Extra
|
||||
-----
|
||||
|
||||
Tags:
|
||||
If it's a bug that needs fixing in a branch in addition to Master, add a '\<release\>-backport-potential' tag (eg ``juno-backport-potential``). There are predefined tags that will autocomplete.
|
||||
|
||||
Status:
|
||||
Please leave this alone, it should be New till someone triages the issue.
|
||||
|
||||
Importance:
|
||||
Should only be touched if it is a Blocker/Gating issue. If it is, please set to High, and only use Critical if you have found a bug that can take down whole infrastructures.
|
||||
|
||||
|
||||
Style guide
|
||||
-----------
|
||||
|
||||
When creating tasks and other roles for use in Ansible please create then using the YAML dictionary format.
|
||||
|
||||
Example YAML dictionary format:
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: The name of the tasks
|
||||
module_name:
|
||||
thing1: "some-stuff"
|
||||
thing2: "some-other-stuff"
|
||||
tags:
|
||||
- some-tag
|
||||
- some-other-tag
|
||||
|
||||
|
||||
Example **NOT** in YAML dictionary format:
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: The name of the tasks
|
||||
module_name: thing1="some-stuff" thing2="some-other-stuff"
|
||||
tags:
|
||||
- some-tag
|
||||
- some-other-tag
|
||||
|
||||
|
||||
Usage of the ">" and "|" operators should be limited to Ansible conditionals and command modules such as the ansible ``shell`` module.
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
When submitting an issue, or working on an issue please ensure the following criteria are met:
|
||||
* The description clearly states or describes the original problem or root cause of the problem.
|
||||
* Include historical information on how the problem was identified.
|
||||
* Any relevant logs are included.
|
||||
* If the issue is a bug that needs fixing in a branch other than Master, add the ‘backport potential’ tag TO THE ISSUE (not the PR).
|
||||
* The provided information should be totally self-contained. External access to web services/sites should not be needed.
|
||||
* If the issue is needed for a hotfix release, add the 'expedite' label.
|
||||
* Steps to reproduce the problem if possible.
|
202
LICENSE
Normal file
202
LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
20
README.rst
Normal file
20
README.rst
Normal file
@ -0,0 +1,20 @@
|
||||
OpenStack Neutron
|
||||
#################
|
||||
:tags: openstack, nova, cloud, ansible
|
||||
:category: \*nix
|
||||
|
||||
Role for deployment, setup and installation of nova.
|
||||
|
||||
This role will install the following:
|
||||
* neutron-server
|
||||
* neutron-agents
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: Installation and setup of Neutron
|
||||
hosts: neutron_all
|
||||
user: root
|
||||
roles:
|
||||
- { role: "os_neutron", tags: [ "os-neutron" ] }
|
||||
vars:
|
||||
galera_address: "{{ internal_lb_vip_address }}"
|
186
defaults/main.yml
Normal file
186
defaults/main.yml
Normal file
@ -0,0 +1,186 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Defines that the role will be deployed on a host machine
|
||||
is_metal: true
|
||||
|
||||
## Verbosity Options
|
||||
debug: False
|
||||
verbose: True
|
||||
|
||||
## neutron User / Group
|
||||
neutron_system_user_name: neutron
|
||||
neutron_system_group_name: neutron
|
||||
neutron_system_comment: neutron system user
|
||||
neutron_system_shell: /bin/false
|
||||
neutron_system_home_folder: "/var/lib/{{ neutron_system_user_name }}"
|
||||
|
||||
## DB
|
||||
neutron_galera_user: neutron
|
||||
neutron_galera_password: "{{ neutron_container_mysql_password }}"
|
||||
neutron_galera_database: neutron
|
||||
neutron_db_revision: head
|
||||
neutron_db_config: /etc/neutron/neutron.conf
|
||||
neutron_db_plugin: /etc/neutron/plugins/ml2/ml2_conf.ini
|
||||
|
||||
## Plugins
|
||||
neutron_plugin_core: neutron.plugins.ml2.plugin.Ml2Plugin
|
||||
neutron_plugin_base:
|
||||
- neutron.services.l3_router.l3_router_plugin.L3RouterPlugin
|
||||
- neutron.services.loadbalancer.plugin.LoadBalancerPlugin
|
||||
- neutron.services.vpn.plugin.VPNDriverPlugin
|
||||
- neutron.services.metering.metering_plugin.MeteringPlugin
|
||||
neutron_plugin_loaded_base: "{% for plugin in neutron_plugin_base %}{{ plugin }}{% if not loop.last %},{% endif %}{% endfor %}"
|
||||
|
||||
## Drivers
|
||||
neutron_driver_network_scheduler: neutron.scheduler.dhcp_agent_scheduler.ChanceScheduler
|
||||
neutron_driver_router_scheduler: neutron.scheduler.l3_agent_scheduler.LeastRoutersScheduler
|
||||
neutron_driver_loadbalancer_pool_scheduler: neutron.services.loadbalancer.agent_scheduler.ChanceScheduler
|
||||
neutron_driver_interface: neutron.agent.linux.interface.BridgeInterfaceDriver
|
||||
neutron_driver_metering: neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver
|
||||
neutron_driver_dhcp: neutron.agent.linux.dhcp.Dnsmasq
|
||||
neutron_driver_notification: neutron.openstack.common.notifier.rpc_notifier
|
||||
neutron_driver_quota: neutron.db.quota_db.DbQuotaDriver
|
||||
|
||||
## General Neutron configuration
|
||||
# If ``neutron_api_workers`` is unset the system will use half the number of available VCPUS to
|
||||
# compute the number of api workers to use.
|
||||
# neutron_api_workers: 16
|
||||
|
||||
# If ``neutron_rpc_workers`` is unset the system will use half the number of ``neutron_api_workers`` to
|
||||
# compute the number of api workers to use.
|
||||
# neutron_rpc_workers: 16
|
||||
|
||||
# If ``neutron_metadata_workers`` is unset the system will use half the number of available VCPUS to
|
||||
# compute the number of api workers to use.
|
||||
# neutron_metadata_workers: 16
|
||||
neutron_metadata_backlog: 128
|
||||
|
||||
|
||||
## Auth
|
||||
neutron_service_tenant_name: service
|
||||
neutron_service_role_name: admin
|
||||
neutron_service_user_name: neutron
|
||||
neutron_service_name: neutron
|
||||
neutron_service_type: network
|
||||
neutron_service_description: "OpenStack Networking"
|
||||
neutron_service_port: 9696
|
||||
neutron_service_proto: http
|
||||
neutron_service_publicuri: "{{ neutron_service_proto }}://{{ external_lb_vip_address }}:{{ neutron_service_port }}"
|
||||
neutron_service_publicurl: "{{ neutron_service_publicuri }}"
|
||||
neutron_service_adminuri: "{{ neutron_service_proto }}://{{ internal_lb_vip_address }}:{{ neutron_service_port }}"
|
||||
neutron_service_adminurl: "{{ neutron_service_adminuri }}"
|
||||
neutron_service_internaluri: "{{ neutron_service_proto }}://{{ internal_lb_vip_address }}:{{ neutron_service_port }}"
|
||||
neutron_service_internalurl: "{{ neutron_service_internaluri }}"
|
||||
neutron_service_region: RegionOne
|
||||
|
||||
neutron_service_program_name: neutron-server
|
||||
neutron_service_program_config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
|
||||
neutron_service_program_enabled: false
|
||||
|
||||
neutron_service_dhcp_program_name: neutron-dhcp-agent
|
||||
neutron_service_dhcp_program_config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini
|
||||
neutron_service_dhcp_program_enabled: false
|
||||
|
||||
neutron_service_l3_program_name: neutron-l3-agent
|
||||
neutron_service_l3_program_config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/l3_agent.ini
|
||||
neutron_service_l3_program_enabled: false
|
||||
|
||||
neutron_service_linuxbridge_program_name: neutron-linuxbridge-agent
|
||||
neutron_service_linuxbridge_program_config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini
|
||||
neutron_service_linuxbridge_program_enabled: false
|
||||
|
||||
neutron_service_metadata_program_name: neutron-metadata-agent
|
||||
neutron_service_metadata_program_config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini
|
||||
neutron_service_metadata_program_enabled: false
|
||||
|
||||
neutron_service_metering_program_name: neutron-metering-agent
|
||||
neutron_service_metering_program_config_options: --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metering_agent.ini
|
||||
neutron_service_metering_program_enabled: false
|
||||
|
||||
## Agent
|
||||
neutron_external_network_bridge: ""
|
||||
neutron_gateway_external_network_id: ""
|
||||
|
||||
neutron_agent_mode: legacy
|
||||
neutron_agent_down_time: 120
|
||||
neutron_agent_polling_interval: 5
|
||||
neutron_report_interval: "{{ neutron_agent_down_time | int / 2 | int }}"
|
||||
neutron_network_device_mtu: 1450
|
||||
|
||||
# L3HA configuration options.
|
||||
neutron_ha_vrrp_advert_int: 2
|
||||
neutron_ha_vrrp_auth_password: None
|
||||
neutron_ha_vrrp_auth_type: PASS
|
||||
neutron_handle_internal_only_routers: True
|
||||
neutron_l3_ha_enabled: False
|
||||
neutron_l3_ha_net_cidr: 169.254.192.0/18
|
||||
|
||||
# If ``neutron_min_l3_agents_per_router`` is unset the system will use half the number of hosts in the
|
||||
# "neutron_agent" group to determine the min agents per routers.
|
||||
# neutron_min_l3_agents_per_router: 3
|
||||
|
||||
# If ``neutron_max_l3_agents_per_router`` is unset the system will use the number of hosts in the
|
||||
# "neutron_agent" group to determine the max agents per routers.
|
||||
# neutron_max_l3_agents_per_router: 3
|
||||
|
||||
# DHCP AGENT CONFIG
|
||||
neutron_dhcp_config:
|
||||
dhcp-option-force: "26,1450"
|
||||
log-facility: "/var/log/neutron/neutron-dnsmasq.log"
|
||||
|
||||
neutron_dhcp_domain: openstacklocal
|
||||
neutron_dhcp_delete_namespaces: True
|
||||
# Comma-separated list of DNS servers which will be used by dnsmasq as forwarders.
|
||||
neutron_dnsmasq_dns_servers: ""
|
||||
# Limit number of leases to prevent a denial-of-service.
|
||||
neutron_dnsmasq_lease_max: 16777216
|
||||
|
||||
## RPC
|
||||
neutron_rpc_backend: rabbit
|
||||
|
||||
neutron_apt_packages:
|
||||
- conntrackd
|
||||
- conntrack
|
||||
- dnsmasq-base
|
||||
- dnsmasq-utils
|
||||
- ipset
|
||||
- iputils-arping
|
||||
- keepalived
|
||||
- libpq-dev
|
||||
|
||||
neutron_pip_packages:
|
||||
- configobj
|
||||
- cliff
|
||||
- keystonemiddleware
|
||||
- MySQL-python
|
||||
- neutron
|
||||
- pycrypto
|
||||
- python-glanceclient
|
||||
- python-keystoneclient
|
||||
- python-memcached
|
||||
- python-neutronclient
|
||||
- python-novaclient
|
||||
- repoze.lru
|
||||
|
||||
## Service Names
|
||||
neutron_service_names:
|
||||
- neutron-agent
|
||||
- neutron-dhcp-agent
|
||||
- neutron-linuxbridge-agent
|
||||
- neutron-l3-agent
|
||||
- neutron-metadata-agent
|
||||
- neutron-metering-agent
|
||||
- neutron-server
|
30
files/api-paste.ini
Normal file
30
files/api-paste.ini
Normal file
@ -0,0 +1,30 @@
|
||||
[composite:neutron]
|
||||
use = egg:Paste#urlmap
|
||||
/: neutronversions
|
||||
/v2.0: neutronapi_v2_0
|
||||
|
||||
[composite:neutronapi_v2_0]
|
||||
use = call:neutron.auth:pipeline_factory
|
||||
noauth = request_id catch_errors extensions neutronapiapp_v2_0
|
||||
keystone = request_id catch_errors authtoken keystonecontext extensions neutronapiapp_v2_0
|
||||
|
||||
[filter:request_id]
|
||||
paste.filter_factory = neutron.openstack.common.middleware.request_id:RequestIdMiddleware.factory
|
||||
|
||||
[filter:catch_errors]
|
||||
paste.filter_factory = neutron.openstack.common.middleware.catch_errors:CatchErrorsMiddleware.factory
|
||||
|
||||
[filter:keystonecontext]
|
||||
paste.filter_factory = neutron.auth:NeutronKeystoneContext.factory
|
||||
|
||||
[filter:authtoken]
|
||||
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
|
||||
|
||||
[filter:extensions]
|
||||
paste.filter_factory = neutron.api.extensions:plugin_aware_extension_middleware_factory
|
||||
|
||||
[app:neutronversions]
|
||||
paste.app_factory = neutron.api.versions:Versions.factory
|
||||
|
||||
[app:neutronapiapp_v2_0]
|
||||
paste.app_factory = neutron.api.v2.router:APIRouter.factory
|
549
files/neutron-ha-tool.py
Normal file
549
files/neutron-ha-tool.py
Normal file
@ -0,0 +1,549 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
# Copyright 2013 AT&T Services, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import random
|
||||
import time
|
||||
from logging.handlers import SysLogHandler
|
||||
from collections import OrderedDict
|
||||
from neutronclient.neutron import client
|
||||
|
||||
|
||||
LOG = logging.getLogger('neutron-ha-tool')
|
||||
LOG_FORMAT = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
|
||||
LOG_DATE = '%m-%d %H:%M'
|
||||
DESCRIPTION = "neutron High Availability Tool"
|
||||
TAKEOVER_DELAY = int(random.random()*30+30)
|
||||
|
||||
|
||||
def parse_args():
|
||||
|
||||
# ensure environment has necessary items to authenticate
|
||||
for key in ['OS_TENANT_NAME', 'OS_USERNAME', 'OS_PASSWORD',
|
||||
'OS_AUTH_URL']:
|
||||
if key not in os.environ.keys():
|
||||
LOG.exception("Your environment is missing '%s'")
|
||||
|
||||
ap = argparse.ArgumentParser(description=DESCRIPTION)
|
||||
ap.add_argument('-d', '--debug', action='store_true',
|
||||
default=False, help='Show debugging output')
|
||||
ap.add_argument('-q', '--quiet', action='store_true', default=False,
|
||||
help='Only show error and warning messages')
|
||||
ap.add_argument('-n', '--noop', action='store_true', default=False,
|
||||
help='Do not do any modifying operations (dry-run)')
|
||||
ap.add_argument('--l3-agent-check', action='store_true', default=False,
|
||||
help='Show routers associated with offline l3 agents')
|
||||
ap.add_argument('--l3-agent-migrate', action='store_true', default=False,
|
||||
help='Migrate routers away from offline l3 agents')
|
||||
ap.add_argument('--l3-agent-rebalance', action='store_true', default=False,
|
||||
help='Rebalance router count on all l3 agents')
|
||||
ap.add_argument('--replicate-dhcp', action='store_true', default=False,
|
||||
help='Replicate DHCP configuration to all agents')
|
||||
ap.add_argument('--now', action='store_true', default=False,
|
||||
help='Migrate Routers immediately without a delay.')
|
||||
ap.add_argument('--insecure', action='store_true', default=False,
|
||||
help='Explicitly allow neutron-ha-tool to perform '
|
||||
'"insecure" SSL (https) requests. The server\'s '
|
||||
'certificate will not be verified against any '
|
||||
'certificate authorities. This option should be used '
|
||||
'with caution.')
|
||||
return ap.parse_args()
|
||||
|
||||
|
||||
def setup_logging(args):
|
||||
level = logging.INFO
|
||||
if args.quiet:
|
||||
level = logging.WARN
|
||||
if args.debug:
|
||||
level = logging.DEBUG
|
||||
logging.basicConfig(level=level, format=LOG_FORMAT, date_fmt=LOG_DATE)
|
||||
handler = SysLogHandler(address='/dev/log')
|
||||
syslog_formatter = logging.Formatter('%(name)s: %(levelname)s %(message)s')
|
||||
handler.setFormatter(syslog_formatter)
|
||||
LOG.addHandler(handler)
|
||||
|
||||
|
||||
def run(args):
|
||||
try:
|
||||
ca = os.environ['OS_CACERT']
|
||||
except KeyError:
|
||||
ca = None
|
||||
|
||||
# instantiate client
|
||||
qclient = client.Client('2.0', auth_url=os.environ['OS_AUTH_URL'],
|
||||
username=os.environ['OS_USERNAME'],
|
||||
tenant_name=os.environ['OS_TENANT_NAME'],
|
||||
password=os.environ['OS_PASSWORD'],
|
||||
endpoint_type='internalURL',
|
||||
insecure=args.insecure,
|
||||
ca_cert=ca)
|
||||
|
||||
# set json return type
|
||||
qclient.format = 'json'
|
||||
|
||||
if args.l3_agent_check:
|
||||
LOG.info("Performing L3 Agent Health Check")
|
||||
l3_agent_check(qclient)
|
||||
|
||||
if args.l3_agent_migrate:
|
||||
LOG.info("Performing L3 Agent Migration for Offline L3 Agents")
|
||||
l3_agent_migrate(qclient, args.noop, args.now)
|
||||
|
||||
if args.l3_agent_rebalance:
|
||||
LOG.info("Rebalancing L3 Agent Router Count")
|
||||
l3_agent_rebalance(qclient, args.noop)
|
||||
|
||||
if args.replicate_dhcp:
|
||||
LOG.info("Performing DHCP Replication of Networks to Agents")
|
||||
replicate_dhcp(qclient, args.noop)
|
||||
|
||||
|
||||
def l3_agent_rebalance(qclient, noop=False):
|
||||
"""
|
||||
Rebalance l3 agent router count across agents. The number of routers
|
||||
on each l3 agent will be as close as possible which should help
|
||||
distribute load as new l3 agents come online.
|
||||
|
||||
:param qclient: A neutronclient
|
||||
:param noop: Optional noop flag
|
||||
"""
|
||||
|
||||
# {u'binary': u'neutron-l3-agent',
|
||||
# u'description': None,
|
||||
# u'admin_state_up': True,
|
||||
# u'heartbeat_timestamp': u'2013-07-02 22:20:23',
|
||||
# u'alive': True,
|
||||
# u'topic': u'l3_agent',
|
||||
# u'host': u'o3r3.int.san3.attcompute.com',
|
||||
# u'agent_type': u'L3 agent',
|
||||
# u'created_at': u'2013-07-02 14:50:58',
|
||||
# u'started_at': u'2013-07-02 18:00:55',
|
||||
# u'id': u'6efe494a-616c-41ea-9c8f-2c592f4d46ff',
|
||||
# u'configurations': {
|
||||
# u'router_id': u'',
|
||||
# u'gateway_external_network_id': u'',
|
||||
# u'handle_internal_only_routers': True,
|
||||
# u'use_namespaces': True,
|
||||
# u'routers': 5,
|
||||
# u'interfaces': 3,
|
||||
# u'floating_ips': 9,
|
||||
# u'interface_driver':
|
||||
# u'neutron.agent.linux.interface.OVSInterfaceDriver',
|
||||
# u'ex_gw_ports': 3}
|
||||
# }
|
||||
|
||||
l3_agent_dict = {}
|
||||
agents = list_agents(qclient, agent_type='L3 agent')
|
||||
num_agents = len(agents)
|
||||
if num_agents <= 1:
|
||||
LOG.info("No rebalancing required for 1 or fewer agents")
|
||||
return
|
||||
|
||||
for l3_agent in agents:
|
||||
l3_agent_dict[l3_agent['id']] = \
|
||||
list_routers_on_l3_agent(qclient, l3_agent['id'])
|
||||
|
||||
ordered_l3_agent_dict = OrderedDict(sorted(l3_agent_dict.items(),
|
||||
key=lambda t: len(t[0])))
|
||||
ordered_l3_agent_list = list(ordered_l3_agent_dict)
|
||||
num_agents = len(ordered_l3_agent_list)
|
||||
LOG.info("Agent list: %s", ordered_l3_agent_list[0:(num_agents-1/2)+1])
|
||||
i = 0
|
||||
for agent in ordered_l3_agent_list[0:num_agents-1/2]:
|
||||
low_agent_id = ordered_l3_agent_list[i]
|
||||
hgh_agent_id = ordered_l3_agent_list[-(i+1)]
|
||||
|
||||
# do nothing if we end up comparing the same router
|
||||
if low_agent_id == hgh_agent_id:
|
||||
continue
|
||||
|
||||
LOG.info("Examining low_agent=%s, high_agent=%s",
|
||||
low_agent_id, hgh_agent_id)
|
||||
|
||||
low_agent_router_count = len(l3_agent_dict[low_agent_id])
|
||||
hgh_agent_router_count = len(l3_agent_dict[hgh_agent_id])
|
||||
|
||||
LOG.info("Low Count=%s, High Count=%s",
|
||||
low_agent_router_count, hgh_agent_router_count)
|
||||
|
||||
for router_id in l3_agent_dict[hgh_agent_id]:
|
||||
if low_agent_router_count >= hgh_agent_router_count:
|
||||
break
|
||||
else:
|
||||
LOG.info("Migrating router=%s from agent=%s to agent=%s",
|
||||
router_id, hgh_agent_id, low_agent_id)
|
||||
try:
|
||||
if not noop:
|
||||
migrate_router(qclient, router_id, hgh_agent_id,
|
||||
low_agent_id)
|
||||
low_agent_router_count += 1
|
||||
hgh_agent_router_count -= 1
|
||||
except:
|
||||
LOG.exception("Failed to migrate router=%s from agent=%s "
|
||||
"to agent=%s", router_id, hgh_agent_id,
|
||||
low_agent_id)
|
||||
continue
|
||||
i += 1
|
||||
|
||||
|
||||
def l3_agent_check(qclient):
|
||||
"""
|
||||
Walk the l3 agents searching for agents that are offline. Show routers
|
||||
that are offline and where we would migrate them to.
|
||||
|
||||
:param qclient: A neutronclient
|
||||
|
||||
"""
|
||||
|
||||
migration_count = 0
|
||||
agent_list = list_agents(qclient)
|
||||
agent_dead_list = agent_dead_id_list(agent_list, 'L3 agent')
|
||||
agent_alive_list = agent_alive_id_list(agent_list, 'L3 agent')
|
||||
LOG.info("There are %s offline L3 agents and %s online L3 agents",
|
||||
len(agent_dead_list), len(agent_alive_list))
|
||||
|
||||
if len(agent_dead_list) > 0:
|
||||
for agent_id in agent_dead_list:
|
||||
LOG.info("Querying agent_id=%s for routers to migrate", agent_id)
|
||||
router_id_list = list_routers_on_l3_agent(qclient, agent_id)
|
||||
|
||||
for router_id in router_id_list:
|
||||
try:
|
||||
target_id = random.choice(agent_alive_list)
|
||||
except IndexError:
|
||||
LOG.warn("There are no l3 agents alive we could "
|
||||
"migrate routers onto.")
|
||||
target_id = None
|
||||
|
||||
migration_count += 1
|
||||
LOG.warn("Would like to migrate router=%s to agent=%s",
|
||||
router_id, target_id)
|
||||
|
||||
if migration_count > 0:
|
||||
sys.exit(2)
|
||||
|
||||
|
||||
def l3_agent_migrate(qclient, noop=False, now=False):
|
||||
"""
|
||||
Walk the l3 agents searching for agents that are offline. For those that
|
||||
are offline, we will retrieve a list of routers on them and migrate them to
|
||||
a random l3 agent that is online.
|
||||
|
||||
:param qclient: A neutronclient
|
||||
:param noop: Optional noop flag
|
||||
:param now: Optional. If false (the default), we'll wait for a random
|
||||
amount of time (between 30 and 60 seconds) before migration. If
|
||||
true, routers are migrated immediately.
|
||||
|
||||
"""
|
||||
|
||||
migration_count = 0
|
||||
agent_list = list_agents(qclient)
|
||||
agent_dead_list = agent_dead_id_list(agent_list, 'L3 agent')
|
||||
agent_alive_list = agent_alive_id_list(agent_list, 'L3 agent')
|
||||
LOG.info("There are %s offline L3 agents and %s online L3 agents",
|
||||
len(agent_dead_list), len(agent_alive_list))
|
||||
|
||||
if len(agent_dead_list) > 0:
|
||||
if len(agent_alive_list) < 1:
|
||||
LOG.exception("There are no l3 agents alive to migrate "
|
||||
"routers onto")
|
||||
|
||||
timeout = 0
|
||||
if not now:
|
||||
while timeout < TAKEOVER_DELAY:
|
||||
|
||||
agent_list_new = list_agents(qclient)
|
||||
agent_dead_list_new = agent_dead_id_list(agent_list_new,
|
||||
'L3 agent')
|
||||
if len(agent_dead_list_new) < len(agent_dead_list):
|
||||
LOG.info("Skipping router failover since an agent came "
|
||||
"online while ensuring agents offline for %s "
|
||||
"seconds", TAKEOVER_DELAY)
|
||||
sys.exit(0)
|
||||
|
||||
LOG.info("Agent found offline for seconds=%s but waiting "
|
||||
"seconds=%s before migration",
|
||||
timeout, TAKEOVER_DELAY)
|
||||
timeout += 1
|
||||
time.sleep(1)
|
||||
|
||||
for agent_id in agent_dead_list:
|
||||
LOG.info("Querying agent_id=%s for routers to migrate", agent_id)
|
||||
router_id_list = list_routers_on_l3_agent(qclient, agent_id)
|
||||
|
||||
for router_id in router_id_list:
|
||||
|
||||
target_id = random.choice(agent_alive_list)
|
||||
LOG.info("Migrating router=%s to agent=%s",
|
||||
router_id, target_id)
|
||||
|
||||
try:
|
||||
if not noop:
|
||||
migrate_router(qclient, router_id, agent_id, target_id)
|
||||
migration_count += 1
|
||||
except:
|
||||
LOG.exception("There was an error migrating a router")
|
||||
continue
|
||||
|
||||
LOG.info("%s routers required migration from offline L3 agents",
|
||||
migration_count)
|
||||
|
||||
|
||||
def replicate_dhcp(qclient, noop=False):
|
||||
"""
|
||||
Retrieve a network list and then probe each DHCP agent to ensure
|
||||
they have that network assigned.
|
||||
|
||||
:param qclient: A neutronclient
|
||||
:param noop: Optional noop flag
|
||||
|
||||
"""
|
||||
|
||||
added = 0
|
||||
networks = list_networks(qclient)
|
||||
network_id_list = [n['id'] for n in networks]
|
||||
agents = list_agents(qclient, agent_type='DHCP agent')
|
||||
LOG.info("Replicating %s networks to %s DHCP agents", len(networks),
|
||||
len(agents))
|
||||
for dhcp_agent_id in [a['id'] for a in agents]:
|
||||
networks_on_agent = \
|
||||
qclient.list_networks_on_dhcp_agent(dhcp_agent_id)['networks']
|
||||
network_id_on_agent = [n['id'] for n in networks_on_agent]
|
||||
for network_id in network_id_list:
|
||||
if network_id not in network_id_on_agent:
|
||||
try:
|
||||
dhcp_body = {'network_id': network_id}
|
||||
if not noop:
|
||||
qclient.add_network_to_dhcp_agent(dhcp_agent_id,
|
||||
dhcp_body)
|
||||
LOG.info("Added missing network=%s to dhcp agent=%s",
|
||||
network_id, dhcp_agent_id)
|
||||
added += 1
|
||||
except:
|
||||
LOG.exception("Failed to add network_id=%s to"
|
||||
"dhcp_agent=%s", network_id, dhcp_agent_id)
|
||||
continue
|
||||
|
||||
LOG.info("Added %s networks to DHCP agents", added)
|
||||
|
||||
|
||||
def migrate_router(qclient, router_id, agent_id, target_id):
|
||||
"""
|
||||
Returns nothing, and raises on exception
|
||||
|
||||
:param qclient: A neutronclient
|
||||
:param router_id: The id of the router to migrate
|
||||
:param agent_id: The id of the l3 agent to migrate from
|
||||
:param target_id: The id of the l3 agent to migrate to
|
||||
"""
|
||||
|
||||
# N.B. The neutron API will return "success" even when there is a
|
||||
# subsequent failure during the add or remove process so we must check to
|
||||
# ensure the router has been added or removed
|
||||
|
||||
# remove the router from the dead agent
|
||||
qclient.remove_router_from_l3_agent(agent_id, router_id)
|
||||
|
||||
# ensure it is removed or log an error
|
||||
if router_id in list_routers_on_l3_agent(qclient, agent_id):
|
||||
LOG.exception("Failed to remove router_id=%s from agent_id=%s",
|
||||
router_id, agent_id)
|
||||
|
||||
# add the router id to a live agent
|
||||
router_body = {'router_id': router_id}
|
||||
qclient.add_router_to_l3_agent(target_id, router_body)
|
||||
|
||||
# ensure it is removed or log an error
|
||||
if router_id not in list_routers_on_l3_agent(qclient, target_id):
|
||||
LOG.exception("Failed to add router_id=%s from agent_id=%s",
|
||||
router_id, agent_id)
|
||||
|
||||
|
||||
def list_networks(qclient):
|
||||
"""
|
||||
Return a list of network objects
|
||||
|
||||
:param qclient: A neutronclient
|
||||
"""
|
||||
|
||||
resp = qclient.list_networks()
|
||||
LOG.debug("list_networks: %s", resp)
|
||||
return resp['networks']
|
||||
|
||||
|
||||
def list_dhcp_agent_networks(qclient, agent_id):
|
||||
"""
|
||||
Return a list of network ids assigned to a particular DHCP agent
|
||||
|
||||
:param qclient: A neutronclient
|
||||
:param agent_id: A DHCP agent id
|
||||
"""
|
||||
|
||||
resp = qclient.list_networks_on_dhcp_agent(agent_id)
|
||||
LOG.debug("list_networks_on_dhcp_agent: %s", resp)
|
||||
return [s['id'] for s in resp['networks']]
|
||||
|
||||
|
||||
def list_routers(qclient):
|
||||
"""
|
||||
Return a list of router objects
|
||||
|
||||
:param qclient: A neutronclient
|
||||
|
||||
# {'routers': [
|
||||
# {u'status': u'ACTIVE',
|
||||
# u'external_gateway_info':
|
||||
# {u'network_id': u'b970297c-d80e-4527-86d7-e49d2da9fdef'},
|
||||
# u'name': u'router1',
|
||||
# u'admin_state_up': True,
|
||||
# u'tenant_id': u'5603b97ee7f047ea999e25492c7fcb23',
|
||||
# u'routes': [],
|
||||
# u'id': u'0a122e5c-1623-412e-8c53-a1e21d1daff8'}
|
||||
# ]}
|
||||
|
||||
"""
|
||||
|
||||
resp = qclient.list_routers()
|
||||
LOG.debug("list_routers: %s", resp)
|
||||
return resp['routers']
|
||||
|
||||
|
||||
def list_routers_on_l3_agent(qclient, agent_id):
|
||||
"""
|
||||
Return a list of router ids on an agent
|
||||
|
||||
:param qclient: A neutronclient
|
||||
"""
|
||||
|
||||
resp = qclient.list_routers_on_l3_agent(agent_id)
|
||||
LOG.debug("list_routers_on_l3_agent: %s", resp)
|
||||
return [r['id'] for r in resp['routers']]
|
||||
|
||||
|
||||
def list_agents(qclient, agent_type=None):
|
||||
"""Return a list of agent objects
|
||||
|
||||
:param qclient: A neutronclient
|
||||
|
||||
|
||||
# {u'agents': [
|
||||
|
||||
# {u'binary': u'neutron-openvswitch-agent',
|
||||
# u'description': None,
|
||||
# u'admin_state_up': True,
|
||||
# u'heartbeat_timestamp': u'2013-07-02 22:20:25',
|
||||
# u'alive': True,
|
||||
# u'topic': u'N/A',
|
||||
# u'host': u'o3r3.int.san3.attcompute.com',
|
||||
# u'agent_type': u'Open vSwitch agent',
|
||||
# u'created_at': u'2013-07-02 14:50:57',
|
||||
# u'started_at': u'2013-07-02 14:50:57',
|
||||
# u'id': u'3a577f1d-d86e-4f1a-a395-8d4c8e4df1e2',
|
||||
# u'configurations': {u'devices': 10}},
|
||||
|
||||
# {u'binary': u'neutron-dhcp-agent',
|
||||
# u'description': None,
|
||||
# u'admin_state_up': True,
|
||||
# u'heartbeat_timestamp': u'2013-07-02 22:20:23',
|
||||
# u'alive': True,
|
||||
# u'topic': u'dhcp_agent',
|
||||
# u'host': u'o5r4.int.san3.attcompute.com',
|
||||
# u'agent_type': u'DHCP agent',
|
||||
# u'created_at': u'2013-06-26 16:21:02',
|
||||
# u'started_at': u'2013-06-28 13:32:52',
|
||||
# u'id': u'3e8be28e-05a0-472b-9288-a59f8d8d2271',
|
||||
# u'configurations': {
|
||||
# u'subnets': 4,
|
||||
# u'use_namespaces': True,
|
||||
# u'dhcp_driver': u'neutron.agent.linux.dhcp.Dnsmasq',
|
||||
# u'networks': 4,
|
||||
# u'dhcp_lease_time': 120,
|
||||
# u'ports': 38}},
|
||||
|
||||
|
||||
# {u'binary': u'neutron-l3-agent',
|
||||
# u'description': None,
|
||||
# u'admin_state_up': True,
|
||||
# u'heartbeat_timestamp': u'2013-07-02 22:20:23',
|
||||
# u'alive': True,
|
||||
# u'topic': u'l3_agent',
|
||||
# u'host': u'o3r3.int.san3.attcompute.com',
|
||||
# u'agent_type': u'L3 agent',
|
||||
# u'created_at': u'2013-07-02 14:50:58',
|
||||
# u'started_at': u'2013-07-02 18:00:55',
|
||||
# u'id': u'6efe494a-616c-41ea-9c8f-2c592f4d46ff',
|
||||
# u'configurations': {
|
||||
# u'router_id': u'',
|
||||
# u'gateway_external_network_id': u'',
|
||||
# u'handle_internal_only_routers': True,
|
||||
# u'use_namespaces': True,
|
||||
# u'routers': 5,
|
||||
# u'interfaces': 3,
|
||||
# u'floating_ips': 9,
|
||||
# u'interface_driver':
|
||||
# u'neutron.agent.linux.interface.OVSInterfaceDriver',
|
||||
# u'ex_gw_ports': 3}},
|
||||
|
||||
"""
|
||||
|
||||
resp = qclient.list_agents()
|
||||
LOG.debug("list_agents: %s", resp)
|
||||
if agent_type:
|
||||
return [agent for agent in resp['agents']
|
||||
if agent['agent_type'] == agent_type]
|
||||
return resp['agents']
|
||||
|
||||
|
||||
def agent_alive_id_list(agent_list, agent_type):
|
||||
"""
|
||||
Return a list of agents that are alive from an API list of agents
|
||||
|
||||
:param agent_list: API response for list_agents()
|
||||
|
||||
"""
|
||||
return [agent['id'] for agent in agent_list
|
||||
if agent['agent_type'] == agent_type and agent['alive'] is True]
|
||||
|
||||
|
||||
def agent_dead_id_list(agent_list, agent_type):
|
||||
"""
|
||||
Return a list of agents that are dead from an API list of agents
|
||||
|
||||
:param agent_list: API response for list_agents()
|
||||
|
||||
"""
|
||||
return [agent['id'] for agent in agent_list
|
||||
if agent['agent_type'] == agent_type and agent['alive'] is False]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = parse_args()
|
||||
setup_logging(args)
|
||||
|
||||
try:
|
||||
run(args)
|
||||
sys.exit(0)
|
||||
except Exception as err:
|
||||
LOG.error(err)
|
||||
sys.exit(1)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(1)
|
138
files/policy.json
Normal file
138
files/policy.json
Normal file
@ -0,0 +1,138 @@
|
||||
{
|
||||
"context_is_admin": "role:admin",
|
||||
"admin_or_owner": "rule:context_is_admin or tenant_id:%(tenant_id)s",
|
||||
"admin_or_network_owner": "rule:context_is_admin or tenant_id:%(network:tenant_id)s",
|
||||
"admin_only": "rule:context_is_admin",
|
||||
"regular_user": "",
|
||||
"shared": "field:networks:shared=True",
|
||||
"shared_firewalls": "field:firewalls:shared=True",
|
||||
"external": "field:networks:router:external=True",
|
||||
"default": "rule:admin_or_owner",
|
||||
|
||||
"create_subnet": "rule:admin_or_network_owner",
|
||||
"get_subnet": "rule:admin_or_owner or rule:shared",
|
||||
"update_subnet": "rule:admin_or_network_owner",
|
||||
"delete_subnet": "rule:admin_or_network_owner",
|
||||
|
||||
"create_network": "",
|
||||
"get_network": "rule:admin_or_owner or rule:shared or rule:external",
|
||||
"get_network:router:external": "rule:regular_user",
|
||||
"get_network:segments": "rule:admin_only",
|
||||
"get_network:provider:network_type": "rule:admin_only",
|
||||
"get_network:provider:physical_network": "rule:admin_only",
|
||||
"get_network:provider:segmentation_id": "rule:admin_only",
|
||||
"get_network:queue_id": "rule:admin_only",
|
||||
"create_network:shared": "rule:admin_only",
|
||||
"create_network:router:external": "rule:admin_only",
|
||||
"create_network:segments": "rule:admin_only",
|
||||
"create_network:provider:network_type": "rule:admin_only",
|
||||
"create_network:provider:physical_network": "rule:admin_only",
|
||||
"create_network:provider:segmentation_id": "rule:admin_only",
|
||||
"update_network": "rule:admin_or_owner",
|
||||
"update_network:segments": "rule:admin_only",
|
||||
"update_network:shared": "rule:admin_only",
|
||||
"update_network:provider:network_type": "rule:admin_only",
|
||||
"update_network:provider:physical_network": "rule:admin_only",
|
||||
"update_network:provider:segmentation_id": "rule:admin_only",
|
||||
"update_network:router:external": "rule:admin_only",
|
||||
"delete_network": "rule:admin_or_owner",
|
||||
|
||||
"create_port": "",
|
||||
"create_port:mac_address": "rule:admin_or_network_owner",
|
||||
"create_port:fixed_ips": "rule:admin_or_network_owner",
|
||||
"create_port:port_security_enabled": "rule:admin_or_network_owner",
|
||||
"create_port:binding:host_id": "rule:admin_only",
|
||||
"create_port:binding:profile": "rule:admin_only",
|
||||
"create_port:mac_learning_enabled": "rule:admin_or_network_owner",
|
||||
"get_port": "rule:admin_or_owner",
|
||||
"get_port:queue_id": "rule:admin_only",
|
||||
"get_port:binding:vif_type": "rule:admin_only",
|
||||
"get_port:binding:vif_details": "rule:admin_only",
|
||||
"get_port:binding:host_id": "rule:admin_only",
|
||||
"get_port:binding:profile": "rule:admin_only",
|
||||
"update_port": "rule:admin_or_owner",
|
||||
"update_port:fixed_ips": "rule:admin_or_network_owner",
|
||||
"update_port:port_security_enabled": "rule:admin_or_network_owner",
|
||||
"update_port:binding:host_id": "rule:admin_only",
|
||||
"update_port:binding:profile": "rule:admin_only",
|
||||
"update_port:mac_learning_enabled": "rule:admin_or_network_owner",
|
||||
"delete_port": "rule:admin_or_owner",
|
||||
|
||||
"get_router:ha": "rule:admin_only",
|
||||
"create_router": "rule:regular_user",
|
||||
"create_router:external_gateway_info:enable_snat": "rule:admin_only",
|
||||
"create_router:distributed": "rule:admin_only",
|
||||
"create_router:ha": "rule:admin_only",
|
||||
"get_router": "rule:admin_or_owner",
|
||||
"get_router:distributed": "rule:admin_only",
|
||||
"update_router:external_gateway_info:enable_snat": "rule:admin_only",
|
||||
"update_router:distributed": "rule:admin_only",
|
||||
"update_router:ha": "rule:admin_only",
|
||||
"delete_router": "rule:admin_or_owner",
|
||||
|
||||
"add_router_interface": "rule:admin_or_owner",
|
||||
"remove_router_interface": "rule:admin_or_owner",
|
||||
|
||||
"create_firewall": "",
|
||||
"get_firewall": "rule:admin_or_owner",
|
||||
"create_firewall:shared": "rule:admin_only",
|
||||
"get_firewall:shared": "rule:admin_only",
|
||||
"update_firewall": "rule:admin_or_owner",
|
||||
"update_firewall:shared": "rule:admin_only",
|
||||
"delete_firewall": "rule:admin_or_owner",
|
||||
|
||||
"create_firewall_policy": "",
|
||||
"get_firewall_policy": "rule:admin_or_owner or rule:shared_firewalls",
|
||||
"create_firewall_policy:shared": "rule:admin_or_owner",
|
||||
"update_firewall_policy": "rule:admin_or_owner",
|
||||
"delete_firewall_policy": "rule:admin_or_owner",
|
||||
|
||||
"create_firewall_rule": "",
|
||||
"get_firewall_rule": "rule:admin_or_owner or rule:shared_firewalls",
|
||||
"update_firewall_rule": "rule:admin_or_owner",
|
||||
"delete_firewall_rule": "rule:admin_or_owner",
|
||||
|
||||
"create_qos_queue": "rule:admin_only",
|
||||
"get_qos_queue": "rule:admin_only",
|
||||
|
||||
"update_agent": "rule:admin_only",
|
||||
"delete_agent": "rule:admin_only",
|
||||
"get_agent": "rule:admin_only",
|
||||
|
||||
"create_dhcp-network": "rule:admin_only",
|
||||
"delete_dhcp-network": "rule:admin_only",
|
||||
"get_dhcp-networks": "rule:admin_only",
|
||||
"create_l3-router": "rule:admin_only",
|
||||
"delete_l3-router": "rule:admin_only",
|
||||
"get_l3-routers": "rule:admin_only",
|
||||
"get_dhcp-agents": "rule:admin_only",
|
||||
"get_l3-agents": "rule:admin_only",
|
||||
"get_loadbalancer-agent": "rule:admin_only",
|
||||
"get_loadbalancer-pools": "rule:admin_only",
|
||||
|
||||
"create_floatingip": "rule:regular_user",
|
||||
"update_floatingip": "rule:admin_or_owner",
|
||||
"delete_floatingip": "rule:admin_or_owner",
|
||||
"get_floatingip": "rule:admin_or_owner",
|
||||
|
||||
"create_network_profile": "rule:admin_only",
|
||||
"update_network_profile": "rule:admin_only",
|
||||
"delete_network_profile": "rule:admin_only",
|
||||
"get_network_profiles": "",
|
||||
"get_network_profile": "",
|
||||
"update_policy_profiles": "rule:admin_only",
|
||||
"get_policy_profiles": "",
|
||||
"get_policy_profile": "",
|
||||
|
||||
"create_metering_label": "rule:admin_only",
|
||||
"delete_metering_label": "rule:admin_only",
|
||||
"get_metering_label": "rule:admin_only",
|
||||
|
||||
"create_metering_label_rule": "rule:admin_only",
|
||||
"delete_metering_label_rule": "rule:admin_only",
|
||||
"get_metering_label_rule": "rule:admin_only",
|
||||
|
||||
"get_service_provider": "rule:regular_user",
|
||||
"get_lsn": "rule:admin_only",
|
||||
"create_lsn": "rule:admin_only"
|
||||
}
|
42
files/post-up-checksum-rules
Normal file
42
files/post-up-checksum-rules
Normal file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# NOTICE:
|
||||
# This script is purpose built to resolve an issue within neutron
|
||||
# where packet checksums are being dropped.
|
||||
# Launchpad issue:
|
||||
# https://bugs.launchpad.net/bugs/1244589
|
||||
#
|
||||
# Open review:
|
||||
# https://review.openstack.org/#/c/148718/
|
||||
#
|
||||
# TODO(cloudnull) remove this script once the bug is fixed.
|
||||
|
||||
|
||||
# Iptables path, used for ipv4 firewall.
|
||||
IPTABLES=$(which iptables)
|
||||
if [ ! -z "${IPTABLES}" ]; then
|
||||
if ! ${IPTABLES} -C POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill 2> /dev/null; then
|
||||
${IPTABLES} -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ip6tables path, used for ipv6 firewall.
|
||||
IP6TABLES=$(which ip6tables)
|
||||
if [ ! -z "${IP6TABLES}" ]; then
|
||||
if ! ${IP6TABLES} -C POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill 2> /dev/null; then
|
||||
${IP6TABLES} -A POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill
|
||||
fi
|
||||
fi
|
34
files/rootwrap.conf
Normal file
34
files/rootwrap.conf
Normal file
@ -0,0 +1,34 @@
|
||||
# Configuration for neutron-rootwrap
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
[DEFAULT]
|
||||
# List of directories to load filter definitions from (separated by ',').
|
||||
# These directories MUST all be only writeable by root !
|
||||
filters_path=/etc/neutron/rootwrap.d,/usr/share/neutron/rootwrap
|
||||
|
||||
# List of directories to search executables in, in case filters do not
|
||||
# explicitely specify a full path (separated by ',')
|
||||
# If not specified, defaults to system PATH environment variable.
|
||||
# These directories MUST all be only writeable by root !
|
||||
exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin
|
||||
|
||||
# Enable logging to syslog
|
||||
# Default value is False
|
||||
use_syslog=False
|
||||
|
||||
# Which syslog facility to use.
|
||||
# Valid values include auth, authpriv, syslog, local0, local1...
|
||||
# Default value is 'syslog'
|
||||
syslog_log_facility=syslog
|
||||
|
||||
# Which messages to log.
|
||||
# INFO means log all usage
|
||||
# ERROR means only log unsuccessful attempts
|
||||
syslog_log_level=ERROR
|
||||
|
||||
[xenapi]
|
||||
# XenAPI configuration is only required by the L2 agent if it is to
|
||||
# target a XenServer/XCP compute host's dom0.
|
||||
xenapi_connection_url=<None>
|
||||
xenapi_connection_username=root
|
||||
xenapi_connection_password=<None>
|
14
files/rootwrap.d/debug.filters
Normal file
14
files/rootwrap.d/debug.filters
Normal file
@ -0,0 +1,14 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# This is needed because we should ping
|
||||
# from inside a namespace which requires root
|
||||
ping: RegExpFilter, ping, root, ping, -w, \d+, -c, \d+, [0-9\.]+
|
||||
ping6: RegExpFilter, ping6, root, ping6, -w, \d+, -c, \d+, [0-9A-Fa-f:]+
|
38
files/rootwrap.d/dhcp.filters
Normal file
38
files/rootwrap.d/dhcp.filters
Normal file
@ -0,0 +1,38 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# dhcp-agent
|
||||
dnsmasq: EnvFilter, dnsmasq, root, NEUTRON_NETWORK_ID=
|
||||
# dhcp-agent uses kill as well, that's handled by the generic KillFilter
|
||||
# it looks like these are the only signals needed, per
|
||||
# neutron/agent/linux/dhcp.py
|
||||
kill_dnsmasq: KillFilter, root, /sbin/dnsmasq, -9, -HUP
|
||||
kill_dnsmasq_usr: KillFilter, root, /usr/sbin/dnsmasq, -9, -HUP
|
||||
|
||||
ovs-vsctl: CommandFilter, ovs-vsctl, root
|
||||
ivs-ctl: CommandFilter, ivs-ctl, root
|
||||
mm-ctl: CommandFilter, mm-ctl, root
|
||||
dhcp_release: CommandFilter, dhcp_release, root
|
||||
|
||||
# metadata proxy
|
||||
metadata_proxy: CommandFilter, neutron-ns-metadata-proxy, root
|
||||
metadata_proxy_quantum: CommandFilter, quantum-ns-metadata-proxy, root
|
||||
# If installed from source (say, by devstack), the prefix will be
|
||||
# /usr/local instead of /usr/bin.
|
||||
metadata_proxy_local: CommandFilter, /usr/local/bin/neutron-ns-metadata-proxy, root
|
||||
metadata_proxy_local_quantum: CommandFilter, /usr/local/bin/quantum-ns-metadata-proxy, root
|
||||
# RHEL invocation of the metadata proxy will report /usr/bin/python
|
||||
kill_metadata: KillFilter, root, python, -9
|
||||
kill_metadata7: KillFilter, root, python2.7, -9
|
||||
kill_metadata6: KillFilter, root, python2.6, -9
|
||||
|
||||
# ip_lib
|
||||
ip: IpFilter, ip, root
|
||||
ip_exec: IpNetnsExecFilter, ip, root
|
12
files/rootwrap.d/ipset-firewall.filters
Normal file
12
files/rootwrap.d/ipset-firewall.filters
Normal file
@ -0,0 +1,12 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
# neutron/agent/linux/iptables_firewall.py
|
||||
# "ipset", "-A", ...
|
||||
ipset: CommandFilter, ipset, root
|
21
files/rootwrap.d/iptables-firewall.filters
Normal file
21
files/rootwrap.d/iptables-firewall.filters
Normal file
@ -0,0 +1,21 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# neutron/agent/linux/iptables_manager.py
|
||||
# "iptables-save", ...
|
||||
iptables-save: CommandFilter, iptables-save, root
|
||||
iptables-restore: CommandFilter, iptables-restore, root
|
||||
ip6tables-save: CommandFilter, ip6tables-save, root
|
||||
ip6tables-restore: CommandFilter, ip6tables-restore, root
|
||||
|
||||
# neutron/agent/linux/iptables_manager.py
|
||||
# "iptables", "-A", ...
|
||||
iptables: CommandFilter, iptables, root
|
||||
ip6tables: CommandFilter, ip6tables, root
|
51
files/rootwrap.d/l3.filters
Normal file
51
files/rootwrap.d/l3.filters
Normal file
@ -0,0 +1,51 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# arping
|
||||
arping: CommandFilter, arping, root
|
||||
|
||||
# l3_agent
|
||||
sysctl: CommandFilter, sysctl, root
|
||||
route: CommandFilter, route, root
|
||||
radvd: CommandFilter, radvd, root
|
||||
|
||||
# metadata proxy
|
||||
metadata_proxy: CommandFilter, neutron-ns-metadata-proxy, root
|
||||
metadata_proxy_quantum: CommandFilter, quantum-ns-metadata-proxy, root
|
||||
# If installed from source (say, by devstack), the prefix will be
|
||||
# /usr/local instead of /usr/bin.
|
||||
metadata_proxy_local: CommandFilter, /usr/local/bin/neutron-ns-metadata-proxy, root
|
||||
metadata_proxy_local_quantum: CommandFilter, /usr/local/bin/quantum-ns-metadata-proxy, root
|
||||
# RHEL invocation of the metadata proxy will report /usr/bin/python
|
||||
kill_metadata: KillFilter, root, python, -9
|
||||
kill_metadata7: KillFilter, root, python2.7, -9
|
||||
kill_metadata6: KillFilter, root, python2.6, -9
|
||||
kill_radvd_usr: KillFilter, root, /usr/sbin/radvd, -9, -HUP
|
||||
kill_radvd: KillFilter, root, /sbin/radvd, -9, -HUP
|
||||
|
||||
# ip_lib
|
||||
ip: IpFilter, ip, root
|
||||
ip_exec: IpNetnsExecFilter, ip, root
|
||||
|
||||
# ovs_lib (if OVSInterfaceDriver is used)
|
||||
ovs-vsctl: CommandFilter, ovs-vsctl, root
|
||||
|
||||
# iptables_manager
|
||||
iptables-save: CommandFilter, iptables-save, root
|
||||
iptables-restore: CommandFilter, iptables-restore, root
|
||||
ip6tables-save: CommandFilter, ip6tables-save, root
|
||||
ip6tables-restore: CommandFilter, ip6tables-restore, root
|
||||
|
||||
# Keepalived
|
||||
keepalived: CommandFilter, keepalived, root
|
||||
kill_keepalived: KillFilter, root, /usr/sbin/keepalived, -HUP, -15, -9
|
||||
|
||||
# l3 agent to delete floatingip's conntrack state
|
||||
conntrack: CommandFilter, conntrack, root
|
26
files/rootwrap.d/lbaas-haproxy.filters
Normal file
26
files/rootwrap.d/lbaas-haproxy.filters
Normal file
@ -0,0 +1,26 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# haproxy
|
||||
haproxy: CommandFilter, haproxy, root
|
||||
|
||||
# lbaas-agent uses kill as well, that's handled by the generic KillFilter
|
||||
kill_haproxy_usr: KillFilter, root, /usr/sbin/haproxy, -9, -HUP
|
||||
|
||||
ovs-vsctl: CommandFilter, ovs-vsctl, root
|
||||
mm-ctl: CommandFilter, mm-ctl, root
|
||||
|
||||
# ip_lib
|
||||
ip: IpFilter, ip, root
|
||||
ip_exec: IpNetnsExecFilter, ip, root
|
||||
route: CommandFilter, route, root
|
||||
|
||||
# arping
|
||||
arping: CommandFilter, arping, root
|
19
files/rootwrap.d/linuxbridge-plugin.filters
Normal file
19
files/rootwrap.d/linuxbridge-plugin.filters
Normal file
@ -0,0 +1,19 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# linuxbridge-agent
|
||||
# unclear whether both variants are necessary, but I'm transliterating
|
||||
# from the old mechanism
|
||||
brctl: CommandFilter, brctl, root
|
||||
bridge: CommandFilter, bridge, root
|
||||
|
||||
# ip_lib
|
||||
ip: IpFilter, ip, root
|
||||
ip_exec: IpNetnsExecFilter, ip, root
|
12
files/rootwrap.d/nec-plugin.filters
Normal file
12
files/rootwrap.d/nec-plugin.filters
Normal file
@ -0,0 +1,12 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# nec_neutron_agent
|
||||
ovs-vsctl: CommandFilter, ovs-vsctl, root
|
22
files/rootwrap.d/openvswitch-plugin.filters
Normal file
22
files/rootwrap.d/openvswitch-plugin.filters
Normal file
@ -0,0 +1,22 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# openvswitch-agent
|
||||
# unclear whether both variants are necessary, but I'm transliterating
|
||||
# from the old mechanism
|
||||
ovs-vsctl: CommandFilter, ovs-vsctl, root
|
||||
ovs-ofctl: CommandFilter, ovs-ofctl, root
|
||||
kill_ovsdb_client: KillFilter, root, /usr/bin/ovsdb-client, -9
|
||||
ovsdb-client: CommandFilter, ovsdb-client, root
|
||||
xe: CommandFilter, xe, root
|
||||
|
||||
# ip_lib
|
||||
ip: IpFilter, ip, root
|
||||
ip_exec: IpNetnsExecFilter, ip, root
|
21
files/rootwrap.d/ryu-plugin.filters
Normal file
21
files/rootwrap.d/ryu-plugin.filters
Normal file
@ -0,0 +1,21 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
# ryu-agent
|
||||
# unclear whether both variants are necessary, but I'm transliterating
|
||||
# from the old mechanism
|
||||
|
||||
# neutron/plugins/ryu/agent/ryu_neutron_agent.py:
|
||||
# "ovs-vsctl", "--timeout=2", ...
|
||||
ovs-vsctl: CommandFilter, ovs-vsctl, root
|
||||
|
||||
# neutron/plugins/ryu/agent/ryu_neutron_agent.py:
|
||||
# "xe", "vif-param-get", ...
|
||||
xe: CommandFilter, xe, root
|
13
files/rootwrap.d/vpnaas.filters
Normal file
13
files/rootwrap.d/vpnaas.filters
Normal file
@ -0,0 +1,13 @@
|
||||
# neutron-rootwrap command filters for nodes on which neutron is
|
||||
# expected to control network
|
||||
#
|
||||
# This file should be owned by (and only-writeable by) the root user
|
||||
|
||||
# format seems to be
|
||||
# cmd-name: filter-name, raw-command, user, args
|
||||
|
||||
[Filters]
|
||||
|
||||
ip: IpFilter, ip, root
|
||||
ip_exec: IpNetnsExecFilter, ip, root
|
||||
openswan: CommandFilter, ipsec, root
|
22
handlers/main.yml
Normal file
22
handlers/main.yml
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Restart neutron services
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: restarted
|
||||
pattern: "{{ item }}"
|
||||
with_items: neutron_service_names
|
||||
failed_when: false
|
35
meta/main.yml
Normal file
35
meta/main.yml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
galaxy_info:
|
||||
author: rcbops
|
||||
description: Installation and setup of neutron
|
||||
company: Rackspace
|
||||
license: Apache2
|
||||
min_ansible_version: 1.6.6
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- trusty
|
||||
categories:
|
||||
- cloud
|
||||
- python
|
||||
- neutron
|
||||
- development
|
||||
- openstack
|
||||
dependencies:
|
||||
- galera_client
|
||||
- openstack_openrc
|
||||
- pip_lock_down
|
32
tasks/main.yml
Normal file
32
tasks/main.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: neutron_pre_install.yml
|
||||
- include: neutron_install.yml
|
||||
- include: neutron_post_install.yml
|
||||
|
||||
- include: neutron_db_setup.yml
|
||||
when: >
|
||||
inventory_hostname == groups['neutron_all'][0]
|
||||
|
||||
- include: neutron_service_setup.yml
|
||||
when: >
|
||||
inventory_hostname == groups['neutron_all'][0]
|
||||
|
||||
- include: neutron_l3_ha.yml
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_agent']
|
||||
|
||||
- include: neutron_upstart_init.yml
|
76
tasks/neutron_db_setup.yml
Normal file
76
tasks/neutron_db_setup.yml
Normal file
@ -0,0 +1,76 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Create DB for service
|
||||
mysql_db:
|
||||
login_user: "{{ galera_root_user }}"
|
||||
login_password: "{{ galera_root_password }}"
|
||||
login_host: "{{ galera_address }}"
|
||||
name: "{{ neutron_galera_database }}"
|
||||
state: "present"
|
||||
tags:
|
||||
- neutron-db-setup
|
||||
|
||||
- name: Grant access to the DB for the service
|
||||
mysql_user:
|
||||
login_user: "{{ galera_root_user }}"
|
||||
login_password: "{{ galera_root_password }}"
|
||||
login_host: "{{ galera_address }}"
|
||||
name: "{{ neutron_galera_user }}"
|
||||
password: "{{ neutron_container_mysql_password }}"
|
||||
host: "{{ item }}"
|
||||
state: "present"
|
||||
priv: "{{ neutron_galera_database }}.*:ALL"
|
||||
with_items:
|
||||
- "localhost"
|
||||
- "%"
|
||||
tags:
|
||||
- neutron-db-setup
|
||||
|
||||
- name: Perform a Neutron DB Upgrade
|
||||
command: |
|
||||
neutron-db-manage --config-file {{ neutron_db_config }}
|
||||
--config-file {{ neutron_db_plugin }}
|
||||
upgrade {{ neutron_db_revision }}
|
||||
sudo: yes
|
||||
sudo_user: "{{ neutron_system_user_name }}"
|
||||
tags:
|
||||
- neutron-db-setup
|
||||
- neutron-upgrade
|
||||
|
||||
# This is using shell because we are grep-ing
|
||||
- name: Check for DB revision
|
||||
shell: |
|
||||
neutron-db-manage history | grep -w 'Revision ID: {{ neutron_db_revision }}'
|
||||
register: neutron_dbmanage
|
||||
failed_when: false
|
||||
changed_when: neutron_dbmanage.rc != 0
|
||||
sudo: yes
|
||||
sudo_user: "{{ neutron_system_user_name }}"
|
||||
tags:
|
||||
- neutron-db-setup
|
||||
- neutron-stamp
|
||||
|
||||
- name: Perform a Neutron DB Stamp
|
||||
command: |
|
||||
neutron-db-manage --config-file {{ neutron_db_config }}
|
||||
--config-file {{ neutron_db_plugin }}
|
||||
stamp {{ neutron_db_revision }}
|
||||
when: neutron_dbmanage.rc != 0
|
||||
sudo: yes
|
||||
sudo_user: "{{ neutron_system_user_name }}"
|
||||
tags:
|
||||
- neutron-db-setup
|
||||
- neutron-stamp
|
41
tasks/neutron_install.yml
Normal file
41
tasks/neutron_install.yml
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install apt packages
|
||||
apt:
|
||||
pkg: "{{ item }}"
|
||||
state: latest
|
||||
update_cache: yes
|
||||
cache_valid_time: 600
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items: neutron_apt_packages
|
||||
tags:
|
||||
- neutron-apt-packages
|
||||
|
||||
- name: Install pip packages
|
||||
pip:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
register: install_packages
|
||||
until: install_packages|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
with_items:
|
||||
- "{{ neutron_pip_packages }}"
|
||||
tags:
|
||||
- neutron-pip-packages
|
76
tasks/neutron_l3_ha.yml
Normal file
76
tasks/neutron_l3_ha.yml
Normal file
@ -0,0 +1,76 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# This should be revised in Kilo
|
||||
# kilo_revision: true
|
||||
|
||||
- name: "Drop AT&T neutron ha tool"
|
||||
copy:
|
||||
src: "neutron-ha-tool.py"
|
||||
dest: "/opt/neutron-ha-tool.py"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
tags:
|
||||
- neutron-ha-tool
|
||||
|
||||
- name: Convert the hostname to an int
|
||||
name2int:
|
||||
name: "{{ inventory_hostname }}"
|
||||
register: hashed_name
|
||||
tags:
|
||||
- neutron-ha-tool
|
||||
|
||||
# These are used in the Neutron HA Cron job script, and processed in the template.
|
||||
- name: Creating Job Facts
|
||||
set_fact:
|
||||
do_job: ". /root/openrc && /opt/neutron-ha-tool.py --l3-agent-migrate"
|
||||
sleep_time: "{{ hashed_name.int_value }}"
|
||||
tags:
|
||||
- neutron-ha-tool
|
||||
|
||||
- name: "Drop Neutron HA job script"
|
||||
template:
|
||||
src: "neutron_ha_tool.sh.j2"
|
||||
dest: "/opt/neutron-ha-tool.sh"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
tags:
|
||||
- neutron-ha-tool
|
||||
|
||||
- name: Create Neutron HA
|
||||
cron:
|
||||
name: "neutron-ha-tool"
|
||||
minute: "*/1"
|
||||
day: "*"
|
||||
hour: "*"
|
||||
month: "*"
|
||||
state: present
|
||||
job: "/opt/neutron-ha-tool.sh"
|
||||
user: root
|
||||
cron_file: "neutron-ha-tool"
|
||||
tags:
|
||||
- neutron-ha-tool
|
||||
|
||||
- name: Remove old cronjobs if found.
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: "absent"
|
||||
with_items:
|
||||
- /etc/cron.d/replicate_dhcp
|
||||
- /etc/cron.d/l3_agent_migrate
|
||||
tags:
|
||||
- neutron-ha-tool
|
93
tasks/neutron_post_install.yml
Normal file
93
tasks/neutron_post_install.yml
Normal file
@ -0,0 +1,93 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Ensure service tenant
|
||||
shell: |
|
||||
. {{ ansible_env.HOME }}/openrc && keystone tenant-list | awk '/service/ {print $2}'
|
||||
register: service_id
|
||||
tags:
|
||||
- neutron-config
|
||||
|
||||
- name: Set service tenant id
|
||||
set_fact:
|
||||
nova_admin_tenant_id: "{{ service_id.stdout }}"
|
||||
tags:
|
||||
- neutron-config
|
||||
|
||||
- name: Generate neutron Config
|
||||
template:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: "{{ neutron_system_user_name }}"
|
||||
group: "{{ neutron_system_group_name }}"
|
||||
with_items:
|
||||
- { src: "dhcp_agent.ini.j2", dest: "/etc/neutron/dhcp_agent.ini" }
|
||||
- { src: "dnsmasq-neutron.conf.j2", dest: "/etc/neutron/dnsmasq-neutron.conf" }
|
||||
- { src: "l3_agent.ini.j2", dest: "/etc/neutron/l3_agent.ini" }
|
||||
- { src: "metadata_agent.ini.j2", dest: "/etc/neutron/metadata_agent.ini" }
|
||||
- { src: "metering_agent.ini.j2", dest: "/etc/neutron/metering_agent.ini" }
|
||||
- { src: "neutron.conf.j2", dest: "/etc/neutron/neutron.conf" }
|
||||
- { src: "plugins/ml2/ml2_conf.ini.j2", dest: "/etc/neutron/plugins/ml2/ml2_conf.ini" }
|
||||
notify:
|
||||
- Restart neutron services
|
||||
tags:
|
||||
- neutron-config
|
||||
|
||||
- name: Drop neutron Configs
|
||||
copy:
|
||||
src: "{{ item.src }}"
|
||||
dest: "{{ item.dest }}"
|
||||
owner: "{{ neutron_system_user_name }}"
|
||||
group: "{{ neutron_system_group_name }}"
|
||||
with_items:
|
||||
- { src: "api-paste.ini", dest: "/etc/neutron/api-paste.ini" }
|
||||
- { src: "policy.json", dest: "/etc/neutron/policy.json" }
|
||||
- { src: "rootwrap.conf", dest: "/etc/neutron/rootwrap.conf" }
|
||||
- { src: "rootwrap.d/debug.filters", dest: "/etc/neutron/rootwrap.d/debug.filters" }
|
||||
- { src: "rootwrap.d/dhcp.filters", dest: "/etc/neutron/rootwrap.d/dhcp.filters" }
|
||||
- { src: "rootwrap.d/ipset-firewall.filters", dest: "/etc/neutron/rootwrap.d/ipset-firewall.filters" }
|
||||
- { src: "rootwrap.d/iptables-firewall.filters", dest: "/etc/neutron/rootwrap.d/iptables-firewall.filters" }
|
||||
- { src: "rootwrap.d/nec-plugin.filters", dest: "/etc/neutron/rootwrap.d/nec-plugin.filters" }
|
||||
- { src: "rootwrap.d/openvswitch-plugin.filters", dest: "/etc/neutron/rootwrap.d/openvswitch-plugin.filters" }
|
||||
- { src: "rootwrap.d/ryu-plugin.filters", dest: "/etc/neutron/rootwrap.d/ryu-plugin.filters" }
|
||||
- { src: "rootwrap.d/lbaas-haproxy.filters", dest: "/etc/neutron/rootwrap.d/lbaas-haproxy.filters" }
|
||||
- { src: "rootwrap.d/linuxbridge-plugin.filters", dest: "/etc/neutron/rootwrap.d/linuxbridge-plugin.filters" }
|
||||
- { src: "rootwrap.d/l3.filters", dest: "/etc/neutron/rootwrap.d/l3.filters" }
|
||||
- { src: "rootwrap.d/vpnaas.filters", dest: "/etc/neutron/rootwrap.d/vpnaas.filters" }
|
||||
notify:
|
||||
- Restart neutron services
|
||||
tags:
|
||||
- neutron-config
|
||||
|
||||
- name: Drop iptables checksum fix
|
||||
copy:
|
||||
src: "post-up-checksum-rules"
|
||||
dest: "/etc/network/if-up.d/post-up-checksum-rules"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0755"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_linuxbridge_agent']
|
||||
tags:
|
||||
- neutron-config
|
||||
- neutron-checksum-fix
|
||||
|
||||
- name: Run iptables checksum fix
|
||||
command: /etc/network/if-up.d/post-up-checksum-rules
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_linuxbridge_agent']
|
||||
tags:
|
||||
- neutron-config
|
||||
- neutron-checksum-fix
|
94
tasks/neutron_pre_install.yml
Normal file
94
tasks/neutron_pre_install.yml
Normal file
@ -0,0 +1,94 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Create the system group
|
||||
group:
|
||||
name: "{{ neutron_system_group_name }}"
|
||||
state: "present"
|
||||
system: "yes"
|
||||
tags:
|
||||
- neutron-group
|
||||
|
||||
- name: Create the neutron system user
|
||||
user:
|
||||
name: "{{ neutron_system_user_name }}"
|
||||
group: "{{ neutron_system_group_name }}"
|
||||
comment: "{{ neutron_system_comment }}"
|
||||
shell: "{{ neutron_system_shell }}"
|
||||
system: "yes"
|
||||
createhome: "yes"
|
||||
home: "/var/lib/{{ neutron_system_user_name }}"
|
||||
tags:
|
||||
- neutron-user
|
||||
|
||||
- name: Create neutron dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
owner: "{{ item.owner|default(neutron_system_user_name) }}"
|
||||
group: "{{ item.group|default(neutron_system_group_name) }}"
|
||||
with_items:
|
||||
- { path: "/etc/neutron" }
|
||||
- { path: "/etc/neutron/plugins" }
|
||||
- { path: "/etc/neutron/plugins/ml2" }
|
||||
- { path: "/etc/neutron/rootwrap.d" }
|
||||
- { path: "/etc/sudoers.d", mode: "0750", owner: "root", group: "root" }
|
||||
- { path: "/var/cache/neutron" }
|
||||
- { path: "/var/lock/neutron" }
|
||||
- { path: "/var/run/neutron" }
|
||||
- { path: "{{ neutron_system_home_folder }}" }
|
||||
- { path: "{{ neutron_system_home_folder }}/ha_confs" }
|
||||
tags:
|
||||
- neutron-dirs
|
||||
|
||||
- name: Test for log directory or link
|
||||
shell: |
|
||||
if [ -h "/var/log/neutron" ]; then
|
||||
chown -h {{ neutron_system_user_name }}:{{ neutron_system_group_name }} "/var/log/neutron"
|
||||
chown -R {{ neutron_system_user_name }}:{{ neutron_system_group_name }} "$(readlink /var/log/neutron)"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
register: log_dir
|
||||
failed_when: false
|
||||
changed_when: log_dir.rc != 0
|
||||
tags:
|
||||
- neutron-dirs
|
||||
- neutron-logs
|
||||
|
||||
- name: Create neutron log dir
|
||||
file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
owner: "{{ item.owner|default(neutron_system_user_name) }}"
|
||||
group: "{{ item.group|default(neutron_system_group_name) }}"
|
||||
mode: "{{ item.mode|default('0755') }}"
|
||||
with_items:
|
||||
- { path: "/var/log/neutron" }
|
||||
when: log_dir.rc != 0
|
||||
tags:
|
||||
- neutron-dirs
|
||||
- neutron-logs
|
||||
|
||||
- name: Drop sudoers file
|
||||
template:
|
||||
src: "sudoers.j2"
|
||||
dest: "/etc/sudoers.d/{{ neutron_system_user_name }}_sudoers"
|
||||
mode: "0440"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
tags:
|
||||
- sudoers
|
||||
- neutron-sudoers
|
89
tasks/neutron_service_add.yml
Normal file
89
tasks/neutron_service_add.yml
Normal file
@ -0,0 +1,89 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Create a service
|
||||
- name: Ensure neutron service
|
||||
keystone:
|
||||
command: "ensure_service"
|
||||
token: "{{ keystone_auth_admin_token }}"
|
||||
endpoint: "{{ keystone_service_adminurl }}"
|
||||
service_name: "{{ service_name }}"
|
||||
service_type: "{{ service_type }}"
|
||||
description: "{{ service_description }}"
|
||||
register: add_service
|
||||
until: add_service|success
|
||||
retries: 5
|
||||
delay: 2
|
||||
tags:
|
||||
- neutron-api-setup
|
||||
- neutron-service-add
|
||||
- neutron-setup
|
||||
|
||||
# Create an admin user
|
||||
- name: Ensure neutron user
|
||||
keystone:
|
||||
command: "ensure_user"
|
||||
token: "{{ keystone_auth_admin_token }}"
|
||||
endpoint: "{{ keystone_service_adminurl }}"
|
||||
user_name: "{{ service_user_name }}"
|
||||
tenant_name: "{{ service_tenant_name }}"
|
||||
password: "{{ service_password }}"
|
||||
register: add_service
|
||||
until: add_service|success
|
||||
retries: 5
|
||||
delay: 10
|
||||
tags:
|
||||
- neutron-api-setup
|
||||
- neutron-service-add
|
||||
- neutron-setup
|
||||
|
||||
# Add a role to the user
|
||||
- name: Ensure neutron user to admin role
|
||||
keystone:
|
||||
command: "ensure_user_role"
|
||||
token: "{{ keystone_auth_admin_token }}"
|
||||
endpoint: "{{ keystone_service_adminurl }}"
|
||||
user_name: "{{ service_user_name }}"
|
||||
tenant_name: "{{ service_tenant_name }}"
|
||||
role_name: "{{ role_name }}"
|
||||
register: add_service
|
||||
until: add_service|success
|
||||
retries: 5
|
||||
delay: 10
|
||||
tags:
|
||||
- neutron-api-setup
|
||||
- neutron-service-add
|
||||
- neutron-setup
|
||||
|
||||
# Create an endpoint
|
||||
- name: Ensure neutron endpoint
|
||||
keystone:
|
||||
command: "ensure_endpoint"
|
||||
token: "{{ keystone_auth_admin_token }}"
|
||||
endpoint: "{{ keystone_service_adminurl }}"
|
||||
region_name: "{{ service_region }}"
|
||||
service_name: "{{ service_name }}"
|
||||
service_type: "{{ service_type }}"
|
||||
publicurl: "{{ service_publicurl }}"
|
||||
adminurl: "{{ service_internalurl }}"
|
||||
internalurl: "{{ service_adminurl }}"
|
||||
register: add_service
|
||||
until: add_service|success
|
||||
retries: 5
|
||||
delay: 10
|
||||
tags:
|
||||
- neutron-api-setup
|
||||
- neutron-service-add
|
||||
- neutron-setup
|
30
tasks/neutron_service_setup.yml
Normal file
30
tasks/neutron_service_setup.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: neutron_service_add.yml
|
||||
vars:
|
||||
service_user_name: "{{ neutron_service_user_name }}"
|
||||
service_tenant_name: "{{ neutron_service_tenant_name }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
service_type: "{{ neutron_service_type }}"
|
||||
service_region: "{{ neutron_service_region }}"
|
||||
service_description: "{{ neutron_service_description }}"
|
||||
service_password: "{{ neutron_service_password }}"
|
||||
service_publicurl: "{{ neutron_service_publicurl }}"
|
||||
service_internalurl: "{{ neutron_service_internalurl }}"
|
||||
service_adminurl: "{{ neutron_service_adminurl }}"
|
||||
role_name: "{{ neutron_service_role_name }}"
|
||||
tags:
|
||||
- neutron-server
|
46
tasks/neutron_upstart_common_init.yml
Normal file
46
tasks/neutron_upstart_common_init.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Place the init script
|
||||
template:
|
||||
src: "neutron-upstart-init.j2"
|
||||
dest: "/etc/init/{{ program_name }}.conf"
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
notify:
|
||||
- Restart neutron services
|
||||
tags:
|
||||
- upstart-init
|
||||
- neutron-init
|
||||
|
||||
- name: Reload init scripts
|
||||
shell: |
|
||||
initctl reload-configuration
|
||||
notify:
|
||||
- Restart neutron services
|
||||
tags:
|
||||
- upstart-init
|
||||
- neutron-init
|
||||
|
||||
- name: Load service
|
||||
service:
|
||||
name: "{{ program_name }}"
|
||||
enabled: "yes"
|
||||
notify:
|
||||
- Restart neutron services
|
||||
tags:
|
||||
- upstart-init
|
||||
- neutron-init
|
98
tasks/neutron_upstart_init.yml
Normal file
98
tasks/neutron_upstart_init.yml
Normal file
@ -0,0 +1,98 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: neutron_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ neutron_service_program_name }}"
|
||||
program_config_options: "{{ neutron_service_program_config_options }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
system_user: "{{ neutron_system_user_name }}"
|
||||
system_group: "{{ neutron_system_group_name }}"
|
||||
service_home: "{{ neutron_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_server'] and
|
||||
neutron_service_program_enabled == true
|
||||
tags:
|
||||
- upstart-init
|
||||
|
||||
- include: neutron_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ neutron_service_dhcp_program_name }}"
|
||||
program_config_options: "{{ neutron_service_dhcp_program_config_options }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
system_user: "{{ neutron_system_user_name }}"
|
||||
system_group: "{{ neutron_system_group_name }}"
|
||||
service_home: "{{ neutron_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_agent'] and
|
||||
neutron_service_dhcp_program_enabled == true
|
||||
tags:
|
||||
- upstart-init
|
||||
|
||||
- include: neutron_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ neutron_service_l3_program_name }}"
|
||||
program_config_options: "{{ neutron_service_l3_program_config_options }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
system_user: "{{ neutron_system_user_name }}"
|
||||
system_group: "{{ neutron_system_group_name }}"
|
||||
service_home: "{{ neutron_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_agent'] and
|
||||
neutron_service_l3_program_enabled == true
|
||||
tags:
|
||||
- upstart-init
|
||||
|
||||
- include: neutron_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ neutron_service_linuxbridge_program_name }}"
|
||||
program_config_options: "{{ neutron_service_linuxbridge_program_config_options }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
system_user: "{{ neutron_system_user_name }}"
|
||||
system_group: "{{ neutron_system_group_name }}"
|
||||
service_home: "{{ neutron_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_linuxbridge_agent'] and
|
||||
neutron_service_linuxbridge_program_enabled == true
|
||||
tags:
|
||||
- upstart-init
|
||||
|
||||
- include: neutron_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ neutron_service_metadata_program_name }}"
|
||||
program_config_options: "{{ neutron_service_metadata_program_config_options }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
system_user: "{{ neutron_system_user_name }}"
|
||||
system_group: "{{ neutron_system_group_name }}"
|
||||
service_home: "{{ neutron_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_agent'] and
|
||||
neutron_service_metadata_program_enabled == true
|
||||
tags:
|
||||
- upstart-init
|
||||
|
||||
- include: neutron_upstart_common_init.yml
|
||||
vars:
|
||||
program_name: "{{ neutron_service_metering_program_name }}"
|
||||
program_config_options: "{{ neutron_service_metering_program_config_options }}"
|
||||
service_name: "{{ neutron_service_name }}"
|
||||
system_user: "{{ neutron_system_user_name }}"
|
||||
system_group: "{{ neutron_system_group_name }}"
|
||||
service_home: "{{ neutron_system_home_folder }}"
|
||||
when: >
|
||||
inventory_hostname in groups['neutron_agent'] and
|
||||
neutron_service_metering_program_enabled == true
|
||||
tags:
|
||||
- upstart-init
|
22
templates/dhcp_agent.ini.j2
Normal file
22
templates/dhcp_agent.ini.j2
Normal file
@ -0,0 +1,22 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
|
||||
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
|
||||
|
||||
[DEFAULT]
|
||||
verbose = {{ verbose }}
|
||||
debug = {{ debug }}
|
||||
|
||||
interface_driver = {{ neutron_driver_interface }}
|
||||
dhcp_driver = {{ neutron_driver_dhcp }}
|
||||
use_namespaces = True
|
||||
enable_isolated_metadata = True
|
||||
|
||||
num_sync_threads = {{ neutron_api_workers | default(api_threads) }}
|
||||
|
||||
dhcp_domain = {{ neutron_dhcp_domain }}
|
||||
dhcp_delete_namespaces = {{ neutron_dhcp_delete_namespaces }}
|
||||
|
||||
dnsmasq_config_file = /etc/neutron/dnsmasq-neutron.conf
|
||||
dnsmasq_dns_servers = {{ neutron_dnsmasq_dns_servers }}
|
||||
dnsmasq_lease_max = {{ neutron_dnsmasq_lease_max }}
|
5
templates/dnsmasq-neutron.conf.j2
Normal file
5
templates/dnsmasq-neutron.conf.j2
Normal file
@ -0,0 +1,5 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for key, value in neutron_dhcp_config.items() %}
|
||||
{{ key }}={{ value }}
|
||||
{% endfor %}
|
32
templates/l3_agent.ini.j2
Normal file
32
templates/l3_agent.ini.j2
Normal file
@ -0,0 +1,32 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[DEFAULT]
|
||||
verbose = {{ verbose }}
|
||||
debug = {{ debug }}
|
||||
|
||||
allow_automatic_l3agent_failover = True
|
||||
enable_metadata_proxy = True
|
||||
external_network_bridge = {{ neutron_external_network_bridge }}
|
||||
gateway_external_network_id = {{ neutron_gateway_external_network_id }}
|
||||
|
||||
# L3 Agent HA
|
||||
ha_confs_path = {{ neutron_system_home_folder }}/ha_confs
|
||||
ha_vrrp_advert_int = {{ neutron_ha_vrrp_advert_int }}
|
||||
ha_vrrp_auth_password = {{ neutron_ha_vrrp_auth_password }}
|
||||
ha_vrrp_auth_type = {{ neutron_ha_vrrp_auth_type }}
|
||||
handle_internal_only_routers = {{ neutron_handle_internal_only_routers }}
|
||||
l3_ha = {{ neutron_l3_ha_enabled }}
|
||||
l3_ha_net_cidr = {{ neutron_l3_ha_net_cidr }}
|
||||
max_l3_agents_per_router = {{ neutron_max_l3_agents_per_router | default(groups['neutron_agent']|length) }}
|
||||
|
||||
{% set min_router = groups['neutron_agent'] | length // 2 %}
|
||||
{% set min_l3_router = min_router if min_router > 0 else 1 %}
|
||||
|
||||
min_l3_agents_per_router = {{ neutron_min_l3_agents_per_router | default(min_l3_router) }}
|
||||
send_arp_for_ha = 3
|
||||
|
||||
# L3 Agent interfaces
|
||||
interface_driver = {{ neutron_driver_interface }}
|
||||
handle_internal_only_routers = True
|
||||
use_namespaces = True
|
||||
agent_mode = {{ neutron_agent_mode }}
|
30
templates/metadata_agent.ini.j2
Normal file
30
templates/metadata_agent.ini.j2
Normal file
@ -0,0 +1,30 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
|
||||
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
|
||||
|
||||
[DEFAULT]
|
||||
verbose = {{ verbose }}
|
||||
debug = {{ debug }}
|
||||
|
||||
# The Neutron user information for accessing the Neutron API.
|
||||
auth_url = {{ keystone_service_adminuri }}
|
||||
auth_region = {{ keystone_service_region }}
|
||||
endpoint_type = adminURL
|
||||
|
||||
# TCP Port used by Nova metadata server
|
||||
nova_metadata_ip = {{ internal_lb_vip_address }}
|
||||
nova_metadata_port = {{ nova_metadata_port }}
|
||||
|
||||
# Admin authentication
|
||||
admin_tenant_name = {{ neutron_service_tenant_name }}
|
||||
admin_user = {{ neutron_service_user_name }}
|
||||
admin_password = {{ neutron_service_password }}
|
||||
|
||||
# Number of backlog requests to configure the metadata server socket with
|
||||
metadata_proxy_shared_secret = {{ nova_metadata_proxy_secret }}
|
||||
metadata_workers = {{ neutron_metadata_workers | default(api_threads) }}
|
||||
metadata_backlog = {{ neutron_metadata_backlog }}
|
||||
|
||||
# Metadata Caching
|
||||
cache_url = memory://?default_ttl=5
|
13
templates/metering_agent.ini.j2
Normal file
13
templates/metering_agent.ini.j2
Normal file
@ -0,0 +1,13 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
[DEFAULT]
|
||||
verbose = {{ verbose }}
|
||||
debug = {{ debug }}
|
||||
|
||||
driver = {{ neutron_driver_metering }}
|
||||
interface_driver = {{ neutron_driver_interface }}
|
||||
measure_interval = 30
|
||||
use_namespaces = True
|
||||
|
||||
[AGENT]
|
||||
report_interval = 30
|
41
templates/neutron-upstart-init.j2
Normal file
41
templates/neutron-upstart-init.j2
Normal file
@ -0,0 +1,41 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# vim:set ft=upstart ts=2 et:
|
||||
|
||||
description "{{ program_name }}"
|
||||
author "Kevin Carter <kevin.carter@rackspace.com>"
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlelvel [016]
|
||||
|
||||
respawn
|
||||
respawn limit 10 5
|
||||
|
||||
# Set the RUNBIN environment variable
|
||||
env RUNBIN="/usr/local/bin/{{ program_name }}"
|
||||
|
||||
# Change directory to service users home
|
||||
chdir "{{ service_home }}"
|
||||
|
||||
# Pre start actions
|
||||
pre-start script
|
||||
mkdir -p "/var/run/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/run/{{ program_name }}"
|
||||
|
||||
mkdir -p "/var/lock/{{ program_name }}"
|
||||
chown {{ system_user }}:{{ system_group }} "/var/lock/{{ program_name }}"
|
||||
end script
|
||||
|
||||
# Post stop actions
|
||||
post-stop script
|
||||
rm "/var/run/{{ program_name }}/{{ program_name }}.pid"
|
||||
end script
|
||||
|
||||
# Run the start up job
|
||||
exec start-stop-daemon --start \
|
||||
--chuid {{ system_user }} \
|
||||
--make-pidfile \
|
||||
--pidfile /var/run/{{ program_name }}/{{ program_name }}.pid \
|
||||
--exec "{{ program_override|default('$RUNBIN') }}" \
|
||||
-- {{ program_config_options|default('') }} \
|
||||
--log-file=/var/log/{{ service_name }}/{{ program_name }}.log
|
125
templates/neutron.conf.j2
Normal file
125
templates/neutron.conf.j2
Normal file
@ -0,0 +1,125 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% set _api_threads = ansible_processor_vcpus|default(2) // 2 %}
|
||||
{% set api_threads = _api_threads if _api_threads > 0 else 1 %}
|
||||
{% set _rpc_threads = api_threads // 2 %}
|
||||
{% set rpc_threads = _rpc_threads if _rpc_threads > 0 else 1 %}
|
||||
|
||||
[DEFAULT]
|
||||
verbose = {{ verbose }}
|
||||
debug = {{ debug }}
|
||||
|
||||
use_syslog = False
|
||||
|
||||
log_file = /var/log/neutron/neutron.log
|
||||
auth_strategy = keystone
|
||||
lock_path = /var/lock/neutron
|
||||
network_device_mtu = {{ neutron_network_device_mtu }}
|
||||
allow_overlapping_ips = True
|
||||
|
||||
|
||||
## Drivers
|
||||
network_scheduler_driver = {{ neutron_driver_network_scheduler }}
|
||||
router_scheduler_driver = {{ neutron_driver_router_scheduler }}
|
||||
loadbalancer_pool_scheduler_driver = {{ neutron_driver_loadbalancer_pool_scheduler }}
|
||||
dhcp_driver = {{ neutron_driver_dhcp }}
|
||||
notification_driver = {{ neutron_driver_notification }}
|
||||
|
||||
|
||||
## Schedulers
|
||||
router_distributed = False
|
||||
network_auto_schedule = True
|
||||
router_auto_schedule = True
|
||||
|
||||
|
||||
## Agents
|
||||
agent_down_time = {{ neutron_agent_down_time }}
|
||||
|
||||
|
||||
## API
|
||||
bind_port = 9696
|
||||
bind_host = 0.0.0.0
|
||||
|
||||
|
||||
## Workers
|
||||
api_workers = {{ neutron_api_workers | default(api_threads) }}
|
||||
rpc_workers = {{ neutron_rpc_workers | default(rpc_threads) }}
|
||||
|
||||
|
||||
## Plugins
|
||||
core_plugin = {{ neutron_plugin_core }}
|
||||
service_plugins = {{ neutron_plugin_loaded_base }}
|
||||
|
||||
|
||||
## MAC Address
|
||||
base_mac = fa:16:3e:00:00:00
|
||||
mac_generation_retries = 16
|
||||
|
||||
|
||||
## DHCP
|
||||
dhcp_agent_notification = True
|
||||
dhcp_agents_per_network = {{ groups['neutron_agent'] | length }}
|
||||
dhcp_delete_namespaces = True
|
||||
dhcp_lease_duration = 86400
|
||||
|
||||
|
||||
## RabbitMQ
|
||||
rabbit_port = {{ rabbitmq_port }}
|
||||
rabbit_userid = {{ rabbitmq_userid }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_hosts = {{ rabbitmq_servers }}
|
||||
|
||||
|
||||
## Notifications
|
||||
notify_nova_on_port_status_changes = True
|
||||
notify_nova_on_port_data_changes = True
|
||||
send_events_interval = 2
|
||||
|
||||
|
||||
## Nova
|
||||
nova_url = {{ nova_service_adminurl|replace('/$(tenant_id)s', '') }}
|
||||
nova_admin_username = {{ nova_service_user_name }}
|
||||
nova_admin_tenant_id = {{ nova_admin_tenant_id }}
|
||||
nova_admin_password = {{ nova_service_password }}
|
||||
nova_admin_auth_url = {{ keystone_service_internalurl }}
|
||||
|
||||
|
||||
[quotas]
|
||||
quota_driver = {{ neutron_driver_quota }}
|
||||
quota_items = network,subnet,port
|
||||
|
||||
|
||||
[agent]
|
||||
polling_interval = {{ neutron_agent_polling_interval|default(5) }}
|
||||
report_interval = {{ neutron_report_interval|int }}
|
||||
root_helper = sudo /usr/local/bin/neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
|
||||
|
||||
[keystone_authtoken]
|
||||
signing_dir = /var/cache/neutron
|
||||
identity_uri = {{ keystone_service_internaluri }}
|
||||
auth_uri = {{ keystone_service_internalurl }}
|
||||
admin_tenant_name = {{ neutron_service_tenant_name }}
|
||||
admin_user = {{ neutron_service_user_name }}
|
||||
admin_password = {{ neutron_service_password }}
|
||||
|
||||
memcached_servers = {{ memcached_servers }}
|
||||
|
||||
token_cache_time = 300
|
||||
revocation_cache_time = 60
|
||||
|
||||
# if your memcached server is shared, use these settings to avoid cache poisoning
|
||||
memcache_security_strategy = ENCRYPT
|
||||
memcache_secret_key = {{ memcached_encryption_key }}
|
||||
|
||||
# if your keystone deployment uses PKI, and you value security over performance:
|
||||
check_revocations_for_cached = False
|
||||
|
||||
|
||||
[database]
|
||||
connection = mysql://{{ neutron_galera_user }}:{{ neutron_container_mysql_password }}@{{ galera_address }}/{{ neutron_galera_database }}?charset=utf8
|
||||
|
||||
|
||||
[service_providers]
|
||||
service_provider = LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
|
||||
service_provider = VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default
|
61
templates/neutron_ha_tool.sh.j2
Normal file
61
templates/neutron_ha_tool.sh.j2
Normal file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
|
||||
LOCKFILE="/var/run/neutron_ha_tool.lock"
|
||||
|
||||
# Trap any errors that might happen in executing the script
|
||||
trap my_trap_handler ERR
|
||||
|
||||
function my_trap_handler() {
|
||||
kill_job
|
||||
}
|
||||
|
||||
function unlock() {
|
||||
rm "${LOCKFILE}"
|
||||
}
|
||||
|
||||
function do_job() {
|
||||
# Do a given job
|
||||
logger "$({{ do_job }})"
|
||||
}
|
||||
|
||||
function cooldown() {
|
||||
# Sleep for a given amount of time
|
||||
sleep {{ sleep_time }}
|
||||
}
|
||||
|
||||
function kill_job() {
|
||||
# If the job needs killing kill the pid and unlock the file.
|
||||
PID="$(cat ${LOCKFILE})"
|
||||
unlock
|
||||
if [ -f "${LOCKFILE}" ]; then
|
||||
kill -9 "${PID}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ ! -f "${LOCKFILE}" ]; then
|
||||
echo $$ | tee "${LOCKFILE}"
|
||||
do_job
|
||||
cooldown
|
||||
unlock
|
||||
else
|
||||
if [ "$(find ${LOCKFILE} -mmin +15)" ]; then
|
||||
logger "Stale pid found for ${LOCKFILE}. Killing any left over processes and unlocking"
|
||||
kill_job
|
||||
fi
|
||||
fi
|
121
templates/plugins/ml2/ml2_conf.ini.j2
Normal file
121
templates/plugins/ml2/ml2_conf.ini.j2
Normal file
@ -0,0 +1,121 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{%- set network_vlan_ranges = [] %}
|
||||
{%- set network_vxlan_ranges = [] %}
|
||||
{%- set network_flat_networks = [] %}
|
||||
{%- set network_mappings = [] %}
|
||||
{%- set network_types = [] %}
|
||||
{%- set used_interfaces = [] %}
|
||||
{%- for net in provider_networks %}
|
||||
{%- if net.network.type == "vlan" %}
|
||||
{%- if "vlan" not in network_types %}
|
||||
{%- if network_types.append("vlan") %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- set vlan_pair = [] %}
|
||||
{%- if vlan_pair.append(net.network.net_name) %}{%- endif %}
|
||||
{%- if vlan_pair.append(net.network.range) %}{%- endif %}
|
||||
{%- if vlan_pair|join(':') not in network_vlan_ranges%}
|
||||
{%- if network_vlan_ranges.append(vlan_pair|join(':')) %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- elif net.network.type == "vxlan" %}
|
||||
{%- if "vxlan" not in network_types %}
|
||||
{%- if network_types.append("vxlan") %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if net.network.range not in network_vxlan_ranges %}
|
||||
{%- if network_vxlan_ranges.append(net.network.range) %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- elif net.network.type == "flat" %}
|
||||
{%- if "flat" not in network_types %}
|
||||
{%- if network_types.append("flat") %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if net.network.net_name not in network_flat_networks %}
|
||||
{%- if network_flat_networks.append(net.network.net_name) %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{% if net.network.type != 'raw' and net.network.type != 'vxlan' %}
|
||||
{%- set map_pair = [] %}
|
||||
{%- if 'net_name' in net.network %}
|
||||
{%- if map_pair.append(net.network.net_name) %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if is_metal == true or is_metal == "True" %}
|
||||
{%- if net.network.host_bind_override is defined %}
|
||||
{%- if map_pair.append(net.network.host_bind_override) %}{%- endif %}
|
||||
{%- else %}
|
||||
{%- if map_pair.append(net.network.container_bridge) %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
{%- if map_pair.append(net.network.container_interface) %}{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
{%- if map_pair|join(':') not in network_mappings %}
|
||||
{%- if network_mappings.append(map_pair|join(':')) %}{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
[ml2]
|
||||
type_drivers = flat,vlan,vxlan,local
|
||||
tenant_network_types = {{ network_types|join(',') }}
|
||||
mechanism_drivers = linuxbridge,l2population
|
||||
|
||||
|
||||
{% if network_flat_networks %}
|
||||
[ml2_type_flat]
|
||||
flat_networks = {{ network_flat_networks|join(',') }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if network_vlan_ranges %}
|
||||
[ml2_type_vlan]
|
||||
network_vlan_ranges = {{ network_vlan_ranges|join(',') }}
|
||||
|
||||
[vlans]
|
||||
tenant_network_type = vlan
|
||||
network_vlan_ranges = {{ network_vlan_ranges|join(',') }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if network_vxlan_ranges %}
|
||||
[ml2_type_vxlan]
|
||||
vxlan_group = {{ neutron_vxlan_group|default('') }}
|
||||
vni_ranges = {{ network_vxlan_ranges|join(',') }}
|
||||
|
||||
|
||||
{% if container_networks.tunnel_address is defined %}
|
||||
[vxlan]
|
||||
enable_vxlan = True
|
||||
vxlan_group = {{ neutron_vxlan_group|default('') }}
|
||||
{% if is_metal == true or is_metal == "True" %}
|
||||
{% set on_metal_tunnel_bridge = 'ansible_' + container_networks.tunnel_address.bridge|replace('-', '_') %}
|
||||
local_ip = {{ hostvars[inventory_hostname][on_metal_tunnel_bridge]['ipv4']['address'] }}
|
||||
{% else %}
|
||||
local_ip = {{ container_networks.tunnel_address.address }}
|
||||
{% endif %}
|
||||
l2_population = True
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
[agent]
|
||||
tunnel_types = vxlan
|
||||
## VXLAN udp port
|
||||
# This is set for the vxlan port and while this
|
||||
# is being set here it's ignored because
|
||||
# the port is assigned by the kernel
|
||||
vxlan_udp_port = 4789
|
||||
|
||||
|
||||
{% if network_mappings is defined %}
|
||||
[linux_bridge]
|
||||
physical_interface_mappings = {{ network_mappings|join(',') }}
|
||||
{% endif %}
|
||||
|
||||
|
||||
[l2pop]
|
||||
agent_boot_time = 180
|
||||
|
||||
[securitygroup]
|
||||
enable_security_group = True
|
||||
enable_ipset = True
|
||||
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
|
4
templates/sudoers.j2
Normal file
4
templates/sudoers.j2
Normal file
@ -0,0 +1,4 @@
|
||||
# {{ ansible_managed }}
|
||||
|
||||
# Defaults:{{ neutron_system_user_name }}!requiretty
|
||||
{{ neutron_system_user_name }} ALL = (root) NOPASSWD: /usr/local/bin/{{ neutron_service_name }}-rootwrap
|
Loading…
Reference in New Issue
Block a user