Merge "Remove Ansible abstraction for Neutron"

This commit is contained in:
Jenkins 2015-08-19 14:34:00 +00:00 committed by Gerrit Code Review
commit 1c2cb5333c
3 changed files with 184 additions and 92 deletions

View File

@ -8,49 +8,33 @@ neutron_database_name: "neutron"
neutron_database_user: "neutron"
neutron_database_address: "{{ kolla_internal_address }}"
# Do not override "service_*" variables
service_database_name: "{{ neutron_database_name }}"
service_database_user: "{{ neutron_database_user }}"
service_database_password: "{{ neutron_database_password }}"
####################
# Docker
####################
docker_neutron_registry: "{{ docker_registry ~ '/' if docker_registry else '' }}"
docker_neutron_namespace: "{{ docker_namespace }}"
kolla_neutron_base_distro: "{{ kolla_base_distro }}"
kolla_neutron_install_type: "{{ kolla_install_type }}"
neutron_server_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-neutron-server"
neutron_server_tag: "{{ openstack_release }}"
neutron_server_image_full: "{{ neutron_server_image }}:{{ neutron_server_tag }}"
kolla_neutron_server_container_name: "neutron-server"
docker_neutron_server_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_server_container_name }}"
docker_neutron_server_tag: "{{ openstack_release }}"
docker_neutron_server_image_full: "{{ docker_neutron_server_image }}:{{ docker_neutron_server_tag }}"
neutron_agents_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-neutron-agents"
neutron_agents_tag: "{{ openstack_release }}"
neutron_agents_image_full: "{{ neutron_agents_image }}:{{ neutron_agents_tag }}"
kolla_neutron_agents_container_name: "neutron-agents"
docker_neutron_agents_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_agents_container_name }}"
docker_neutron_agents_tag: "{{ openstack_release }}"
docker_neutron_agents_image_full: "{{ docker_neutron_agents_image }}:{{ docker_neutron_agents_tag }}"
neutron_openvswitch_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-neutron-openvswitch-agent"
neutron_openvswitch_agent_tag: "{{ openstack_release }}"
neutron_openvswitch_agent_image_full: "{{ neutron_openvswitch_agent_image }}:{{ neutron_openvswitch_agent_tag }}"
kolla_neutron_openvswitch_agent_container_name: "neutron-openvswitch-agent"
docker_neutron_openvswitch_agent_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_openvswitch_agent_container_name }}"
docker_neutron_openvswitch_agent_tag: "{{ openstack_release }}"
docker_neutron_openvswitch_agent_image_full: "{{ docker_neutron_openvswitch_agent_image }}:{{ docker_neutron_openvswitch_agent_tag }}"
neutron_linuxbridge_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-neutron-linuxbridge-agent"
neutron_linuxbridge_agent_tag: "{{ openstack_release }}"
neutron_linuxbridge_agent_image_full: "{{ neutron_linuxbridge_agent_image }}:{{ neutron_linuxbridge_agent_tag }}"
kolla_neutron_linuxbridge_agent_container_name: "neutron-linuxbridge-agent"
docker_neutron_linuxbridge_agent_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_neutron_linuxbridge_agent_container_name }}"
docker_neutron_linuxbridge_agent_tag: "{{ openstack_release }}"
docker_neutron_linuxbridge_agent_image_full: "{{ docker_neutron_linuxbridge_agent_image }}:{{ docker_neutron_linuxbridge_agent_tag }}"
openvswitch_vswitchd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-ovs-vswitchd"
openvswitch_vswitchd_tag: "{{ openstack_release }}"
openvswitch_vswitchd_image_full: "{{ openvswitch_vswitchd_image }}:{{ openvswitch_vswitchd_tag }}"
kolla_openvswitch_db_container_name: "ovs-db-server"
docker_openvswitch_db_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_openvswitch_db_container_name }}"
docker_openvswitch_db_tag: "{{ openstack_release }}"
docker_openvswitch_db_image_full: "{{ docker_openvswitch_db_image }}:{{ docker_openvswitch_db_tag }}"
kolla_openvswitch_vswitchd_container_name: "ovs-vswitchd"
docker_openvswitch_vswitchd_image: "{{ docker_neutron_registry }}{{ docker_neutron_namespace }}/{{ kolla_neutron_base_distro }}-{{ kolla_neutron_install_type }}-{{ kolla_openvswitch_vswitchd_container_name }}"
docker_openvswitch_vswitchd_tag: "{{ openstack_release }}"
docker_openvswitch_vswitchd_image_full: "{{ docker_openvswitch_vswitchd_image }}:{{ docker_openvswitch_vswitchd_tag }}"
openvswitch_db_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-ovs-db-server"
openvswitch_db_tag: "{{ openstack_release }}"
openvswitch_db_image_full: "{{ openvswitch_db_image }}:{{ openvswitch_db_tag }}"
####################

View File

@ -1,12 +1,62 @@
---
- include: ../../bootstrap.yml
vars:
container_detach: False
container_environment:
- name: Creating Neutron database
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
-m mysql_db
-a "login_host='{{ database_address }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ neutron_database_name }}'"
register: database
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: database.stdout.split()[2] != 'SUCCESS'
run_once: True
- name: Creating Neutron database user and setting permissions
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
-m mysql_user
-a "login_host='{{ database_address }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ neutron_database_name }}'
password='{{ neutron_database_password }}'
host='%'
priv='{{ neutron_database_name }}.*:ALL'
append_privs='yes'"
register: database_user
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and (database_user.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: database_user.stdout.split()[2] != 'SUCCESS'
run_once: True
- name: Starting Neutron bootstrap container
docker:
detach: False
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "no"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: bootstrap_neutron
image: "{{ neutron_server_image_full }}"
volumes: "{{ node_config_directory }}/neutron-server/:/opt/kolla/neutron-server/:ro"
env:
KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_server_image_full }}"
container_name: "bootstrap_neutron"
container_restart_policy: "no"
container_volumes:
- "{{ node_config_directory }}/neutron-server/:/opt/kolla/neutron-server/:ro"
run_once: True
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_neutron
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed
- name: Cleaning up Neutron boostrap container
docker:
name: bootstrap_neutron
image: "{{ neutron_server_image_full }}"
state: absent
when: database.stdout.find('localhost | SUCCESS => ') != -1 and (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed

View File

@ -1,25 +1,45 @@
---
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_openvswitch_db_image_full }}"
container_name: "openvswitch_db"
container_volumes:
- name: Starting Openvswitch-db container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: openvswitch_db
image: "{{ openvswitch_db_image_full }}"
volumes:
- "/run:/run"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_openvswitch_vswitchd_image_full }}"
container_name: "openvswitch_vswitchd"
container_privileged: "True"
container_volumes:
- name: Starting Openvswitch-vswitchd container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
name: openvswitch_vswitchd
image: "{{ openvswitch_vswitchd_image_full }}"
volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
@ -30,55 +50,93 @@
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- include: ../../start.yml
vars:
container_environment:
- name: Starting Neutron-server container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
name: neutron_server
image: "{{ neutron_server_image_full }}"
volumes: "{{ node_config_directory }}/neutron-server/:/opt/kolla/neutron-server/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_server_image_full }}"
container_name: "neutron_server"
container_volumes:
- "{{ node_config_directory }}/neutron-server/:/opt/kolla/neutron-server/:ro"
when: inventory_hostname in groups['neutron-server']
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_openvswitch_agent_image_full }}"
container_name: "neutron_openvswitch_agent"
container_privileged: "True"
container_volumes:
- name: Starting Neutron-openvswitch-agent container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
name: neutron_openvswitch_agent
image: "{{ neutron_openvswitch_agent_image_full }}"
volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "{{ node_config_directory }}/neutron-openvswitch-agent/:/opt/kolla/neutron-openvswitch-agent/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "openvswitch"
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
NEUTRON_BRIDGE: "br-ex"
NEUTRON_INTERFACE: "{{ neutron_external_interface }}"
container_image: "{{ docker_neutron_linuxbridge_agent_image_full }}"
container_name: "neutron_linuxbridge_agent"
container_privileged: "True"
container_volumes:
- name: Starting Neutron-linuxbridge-agent container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
name: neutron_linuxbridge_agent
image: "{{ neutron_linuxbridge_agent_image_full }}"
volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "{{ node_config_directory }}/neutron-linuxbridge-agent/:/opt/kolla/neutron-linuxbridge-agent/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
NEUTRON_BRIDGE: "br-ex"
NEUTRON_INTERFACE: "{{ neutron_external_interface }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
and neutron_plugin_agent == "linuxbridge"
- include: ../../start.yml
vars:
container_environment:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
container_image: "{{ docker_neutron_agents_image_full }}"
container_name: "neutron_agents"
container_privileged: "True"
container_volumes:
- name: Starting Neutron-agents container
docker:
docker_api_version: "{{ docker_api_version }}"
net: host
pull: "{{ docker_pull_policy }}"
restart_policy: "{{ docker_restart_policy }}"
restart_policy_retry: "{{ docker_restart_policy_retry }}"
state: reloaded
registry: "{{ docker_registry }}"
username: "{{ docker_registry_username }}"
password: "{{ docker_registry_password }}"
insecure_registry: "{{ docker_insecure_registry }}"
privileged: True
name: neutron_agents
image: "{{ neutron_agents_image_full }}"
volumes:
- "/run:/run"
- "{{ node_config_directory }}/neutron-agents/:/opt/kolla/neutron-agents/:ro"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['neutron-agents']