Convert neutron to kolla_docker

Change-Id: Id58586ac20ee081eb731deb23e5f8dc26dfb8cc2
Partially-Implements: blueprint kolla-docker-module
This commit is contained in:
SamYaple 2015-12-26 01:11:31 +00:00
parent 2f03fc81ec
commit 4bd6285dc7
2 changed files with 82 additions and 178 deletions

View File

@ -35,41 +35,18 @@
run_once: True run_once: True
delegate_to: "{{ groups['neutron-server'][0] }}" delegate_to: "{{ groups['neutron-server'][0] }}"
- name: Starting Neutron bootstrap container - name: Running Neutron bootstrap container
docker: kolla_docker:
tty: True action: "start_container"
common_options: "{{ docker_common_options }}"
detach: False detach: False
net: host environment:
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/:{{ container_config_directory }}/:ro"
env:
KOLLA_BOOTSTRAP: KOLLA_BOOTSTRAP:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
run_once: True
delegate_to: "{{ groups['neutron-server'][0] }}"
when: database_created
# https://github.com/ansible/ansible-modules-core/pull/1031
- name: Waiting for bootstrap container to exit
command: docker wait bootstrap_neutron
register: bootstrap_result
run_once: True
failed_when: bootstrap_result.stdout != "0"
delegate_to: "{{ groups['neutron-server'][0] }}"
when: database_created
- name: Cleaning up Neutron bootstrap container
docker:
name: bootstrap_neutron
image: "{{ neutron_server_image_full }}" image: "{{ neutron_server_image_full }}"
state: absent name: "bootstrap_neutron"
restart_policy: "never"
volumes: "{{ node_config_directory }}/neutron-server/:{{ container_config_directory }}/:ro"
run_once: True
delegate_to: "{{ groups['neutron-server'][0] }}" delegate_to: "{{ groups['neutron-server'][0] }}"
when: database_created when: database_created

View File

@ -1,197 +1,124 @@
--- ---
- name: Starting Openvswitch data container - name: Starting openvswitch-data container
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
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_data
image: "{{ openvswitch_data_image_full }}" image: "{{ openvswitch_data_image_full }}"
name: "openvswitch_data"
volumes: "/var/lib/openvswitch/" volumes: "/var/lib/openvswitch/"
- name: Starting Openvswitch-db container - name: Starting openvswitch-db container
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
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 }}" image: "{{ openvswitch_db_image_full }}"
name: "openvswitch_db"
volumes: volumes:
- "/run:/run"
- "{{ node_config_directory }}/openvswitch-db-server/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/openvswitch-db-server/:{{ container_config_directory }}/:ro"
volumes_from: - "/run:/run"
- openvswitch_data volumes_from: "openvswitch_data"
env: when:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents']) - neutron_plugin_agent == "openvswitch"
and neutron_plugin_agent == "openvswitch"
- name: Ensuring OVS bridge is properly setup - name: Ensuring OVS bridge is properly setup
command: docker exec openvswitch_db /usr/local/bin/kolla_ensure_openvswitch_configured {{ neutron_bridge_name }} {{ neutron_external_interface }} command: docker exec openvswitch_db /usr/local/bin/kolla_ensure_openvswitch_configured {{ neutron_bridge_name }} {{ neutron_external_interface }}
register: status register: status
changed_when: status.stdout.find('changed') != -1 changed_when: status.stdout.find('changed') != -1
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents']) when:
and neutron_plugin_agent == "openvswitch" - (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
- neutron_plugin_agent == "openvswitch"
- name: Starting Openvswitch-vswitchd container - name: Starting openvswitch-vswitchd container
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
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 }}" image: "{{ openvswitch_vswitchd_image_full }}"
name: "openvswitch_vswitchd"
privileged: True
volumes: volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "{{ node_config_directory }}/openvswitch-vswitchd/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/openvswitch-vswitchd/:{{ container_config_directory }}/:ro"
env: - "/lib/modules:/lib/modules:ro"
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - "/run:/run"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents']) when:
and neutron_plugin_agent == "openvswitch" - (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
- neutron_plugin_agent == "openvswitch"
- name: Starting Neutron-server container - name: Starting neutron-server container
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
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 }}" image: "{{ neutron_server_image_full }}"
name: "neutron_server"
volumes: volumes:
- "{{ node_config_directory }}/neutron-server/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/neutron-server/:{{ container_config_directory }}/:ro"
- "/var/lib/kolla/dev/log:/dev/log" - "/var/lib/kolla/dev/log:/dev/log"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['neutron-server'] when: inventory_hostname in groups['neutron-server']
- name: Starting Neutron-openvswitch-agent container - name: Starting neutron-openvswitch-agent container
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
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 }}" image: "{{ neutron_openvswitch_agent_image_full }}"
name: "neutron_openvswitch_agent"
privileged: True
volumes: volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "{{ node_config_directory }}/neutron-openvswitch-agent/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/neutron-openvswitch-agent/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "/var/lib/kolla/dev/log:/dev/log" - "/var/lib/kolla/dev/log:/dev/log"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: when:
- neutron_plugin_agent == "openvswitch" - neutron_plugin_agent == "openvswitch"
- ((inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents']) and not (enable_nova_fake | bool)) or - ((inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents']) and not (enable_nova_fake | bool)) or
((inventory_hostname in groups['neutron-agents']) and (enable_nova_fake | bool)) ((inventory_hostname in groups['neutron-agents']) and (enable_nova_fake | bool))
- name: Starting Neutron-openvswitch-agent container for fake nova compute - name: Starting Neutron-openvswitch-agent container for fake nova compute
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
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_fake_{{ item }}
image: "{{ neutron_openvswitch_agent_image_full }}" image: "{{ neutron_openvswitch_agent_image_full }}"
name: "neutron_openvswitch_agent_fake_{{ item }}"
privileged: True
volumes: volumes:
- "/run:/run"
- "/lib/modules:/lib/modules:ro"
- "{{ node_config_directory }}/neutron-openvswitch-agent-fake-{{ item }}/:{{ container_config_directory }}/:ro" - "{{ node_config_directory }}/neutron-openvswitch-agent-fake-{{ item }}/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "/var/lib/kolla/dev/log:/dev/log" - "/var/lib/kolla/dev/log:/dev/log"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
with_sequence: start=1 end={{ num_nova_fake_per_node }} with_sequence: start=1 end={{ num_nova_fake_per_node }}
when: when:
- inventory_hostname in groups['compute'] - inventory_hostname in groups['compute']
- neutron_plugin_agent == "openvswitch" - neutron_plugin_agent == "openvswitch"
- enable_nova_fake | bool - enable_nova_fake | bool
- name: Starting Neutron-linuxbridge-agent container - name: Starting neutron-linuxbridge-agent container
docker: kolla_docker:
tty: True action: "start_container"
net: host common_options: "{{ docker_common_options }}"
pull: "{{ docker_pull_policy }}" environment:
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/:{{ container_config_directory }}/:ro"
- "/var/lib/kolla/dev/log:/dev/log"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
NEUTRON_BRIDGE: "br-ex" NEUTRON_BRIDGE: "br-ex"
NEUTRON_INTERFACE: "{{ neutron_external_interface }}" NEUTRON_INTERFACE: "{{ neutron_external_interface }}"
when: (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents']) image: "{{ neutron_linuxbridge_agent_image_full }}"
and neutron_plugin_agent == "linuxbridge" name: "neutron_linuxbridge_agent"
- name: Starting Neutron-agents container
docker:
tty: True
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 privileged: True
name: neutron_agents
image: "{{ neutron_agents_image_full }}"
volumes: volumes:
- "{{ node_config_directory }}/neutron-linuxbridge-agent/:{{ container_config_directory }}/:ro"
- "/lib/modules:/lib/modules:ro"
- "/run:/run"
- "/var/lib/kolla/dev/log:/dev/log"
when:
- (inventory_hostname in groups['compute'] or inventory_hostname in groups['neutron-agents'])
- neutron_plugin_agent == "linuxbridge"
- name: Starting neutron-agents container
kolla_docker:
action: "start_container"
common_options: "{{ docker_common_options }}"
image: "{{ neutron_agents_image_full }}"
name: "neutron_agents"
privileged: True
volumes:
- "{{ node_config_directory }}/neutron-agents/:{{ container_config_directory }}/:ro"
- "/run:/run" - "/run:/run"
- "{{ node_config_directory }}/neutron-agents/:{{ container_config_directory }}/:ro"
- "/var/lib/kolla/dev/log:/dev/log" - "/var/lib/kolla/dev/log:/dev/log"
env:
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
when: inventory_hostname in groups['neutron-agents'] when: inventory_hostname in groups['neutron-agents']