kolla-ansible/ansible/roles/neutron/tasks/do_reconfigure.yml
Vikram Hosakote e12d63410b Reconfigure neutron service
This patch set implements reconfiguring the neutron service.

Change-Id: I028a91761de2ff7c6dee563259181b946e8312ea
Partially-implements: bp kolla-reconfig
2016-03-03 07:37:49 +00:00

273 lines
10 KiB
YAML

---
- name: Ensuring the containers running neutron-server and neutron agents are up
kolla_docker:
name: "{{ item.name }}"
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when: inventory_hostname in groups[item.group]
with_items:
- { name: neutron_server, group: neutron-server }
- { name: neutron_dhcp_agent, group: neutron-dhcp-agent }
- { name: neutron_l3_agent, group: neutron-l3-agent }
- { name: neutron_metadata_agent, group: neutron-metadata-agent }
- name: Ensuring the neutron_openvswitch_agent container is up
kolla_docker:
name: neutron_openvswitch_agent
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when:
- (
( inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and not enable_nova_fake | bool
) or
( inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and enable_nova_fake | bool
)
)
- neutron_plugin_agent == "openvswitch"
- name: Ensuring the neutron_linuxbridge_agent container is up
kolla_docker:
name: neutron_openvswitch_agent
action: "get_container_state"
register: container_state
failed_when: container_state.Running == false
when:
- (inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent'])
- neutron_plugin_agent == "linuxbridge"
- include: config.yml
- name: Check the configs in containers running neutron-server and neutron agents
command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
register: check_results
when: inventory_hostname in groups[item.group]
with_items:
- { name: neutron_server, group: neutron-server }
- { name: neutron_dhcp_agent, group: neutron-dhcp-agent }
- { name: neutron_l3_agent, group: neutron-l3-agent }
- { name: neutron_metadata_agent, group: neutron-metadata-agent }
- name: Check the configs in the neutron_openvswitch_agent container
command: docker exec neutron_openvswitch_agent /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
when:
- (
( inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and not enable_nova_fake | bool
) or
( inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and enable_nova_fake | bool
)
)
- neutron_plugin_agent == "openvswitch"
- name: Check the configs in the neutron_linuxbridge_agent container
command: docker exec neutron_linuxbridge_agent /usr/local/bin/kolla_set_configs --check
changed_when: false
failed_when: false
when:
- (inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent'])
- neutron_plugin_agent == "linuxbridge"
# NOTE(jeffrey4l): when config_strategy == 'COPY_ALWAYS'
# and container env['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE',
# just remove the container and start again
- name: Containers config strategy for containers running neutron-server and neutron agents
kolla_docker:
name: "{{ item.name }}"
action: "get_container_env"
register: container_envs
when: inventory_hostname in groups[item.group]
with_items:
- { name: neutron_server, group: neutron-server }
- { name: neutron_dhcp_agent, group: neutron-dhcp-agent }
- { name: neutron_l3_agent, group: neutron-l3-agent }
- { name: neutron_metadata_agent, group: neutron-metadata-agent }
- name: Container config strategy for the neutron_openvswitch_agent container
kolla_docker:
name: "neutron_openvswitch_agent"
action: "get_container_env"
when:
- (
( inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and not enable_nova_fake | bool
) or
( inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and enable_nova_fake | bool
)
)
- neutron_plugin_agent == "openvswitch"
- name: Container config strategy for the neutron_linuxbridge_agent container
kolla_docker:
name: "neutron_linuxbridge_agent"
action: "get_container_env"
when:
- (inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent'])
- neutron_plugin_agent == "linuxbridge"
- name: Remove the containers running neutron-server and neutron agents
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "remove_container"
register: remove_containers
when:
- config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[2]['rc'] == 1
- inventory_hostname in groups[item[0]['group']]
with_together:
- [{ name: neutron_server, group: neutron-server },
{ name: neutron_dhcp_agent, group: neutron-dhcp-agent },
{ name: neutron_l3_agent, group: neutron-l3-agent },
{ name: neutron_metadata_agent, group: neutron-metadata-agent }]
- container_envs.results
- check_results.results
- name: Remove the neutron_openvswitch_agent container
kolla_docker:
name: "neutron_openvswitch_agent"
action: "remove_container"
register: remove_containers
when:
- config_strategy == "COPY_ONCE" or item[0]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[1]['rc'] == 1
- (
( inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and not enable_nova_fake | bool
) or
( inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and enable_nova_fake | bool
)
)
- neutron_plugin_agent == "openvswitch"
with_together:
- container_envs.results
- check_results.results
- name: Remove the neutron_linuxbridge_agent container
kolla_docker:
name: "neutron_linuxbridge_agent"
action: "remove_container"
register: remove_containers
when:
- config_strategy == "COPY_ONCE" or item[0]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE'
- item[1]['rc'] == 1
- (inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent'])
- neutron_plugin_agent == "linuxbridge"
with_together:
- container_envs.results
- check_results.results
- include: start.yml
when: remove_containers.changed
- name: Restart containers running neutron-server and neutron agents
kolla_docker:
name: "{{ item[0]['name'] }}"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[2]['rc'] == 1
- inventory_hostname in groups[item[0]['group']]
with_together:
- [{ name: neutron_server, group: neutron-server },
{ name: neutron_dhcp_agent, group: neutron-dhcp-agent },
{ name: neutron_l3_agent, group: neutron-l3-agent },
{ name: neutron_metadata_agent, group: neutron-metadata-agent }]
- container_envs.results
- check_results.results
- name: Restart the neutron_openvswitch_agent container
kolla_docker:
name: "neutron_openvswitch_agent"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
- (
( inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and not enable_nova_fake | bool
) or
( inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent']
and enable_nova_fake | bool
)
)
- neutron_plugin_agent == "openvswitch"
with_together:
- container_envs.results
- check_results.results
- name: Restart the neutron_linuxbridge_agent container
kolla_docker:
name: "neutron_linuxbridge_agent"
action: "restart_container"
when:
- config_strategy == 'COPY_ALWAYS'
- item[0]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE'
- item[1]['rc'] == 1
- (inventory_hostname in groups['compute']
or inventory_hostname in groups['manila-share']
or inventory_hostname in groups['neutron-dhcp-agent']
or inventory_hostname in groups['neutron-l3-agent']
or inventory_hostname in groups['neutron-metadata-agent'])
- neutron_plugin_agent == "linuxbridge"
with_together:
- container_envs.results
- check_results.results