openstack-ansible-os_neutron/tasks/neutron_l3_ha.yml
Jesse Pretorius bd728b82b7 Update legacy neutron L3HA tool support
This tool is still useful in some environments. In this
patch we ensure that if it is enabled, the openrc file
will be deployed on the host. We also remove the TODO
for it's removal.

Change-Id: I427765d0ff219b38bc3c86384e3807321db59dec
2018-11-07 12:16:18 +00:00

72 lines
2.2 KiB
YAML

---
# 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: Implement the legacy neutron L3HA tool scripts
when:
- neutron_legacy_ha_tool_enabled | bool
block:
- name: Implement the neutron HA tool script
template:
src: "neutron-ha-tool.py.j2"
dest: "/opt/neutron-ha-tool.py"
owner: "root"
group: "root"
mode: "0755"
- name: Convert the hostname to an int
name2int:
name: "{{ inventory_hostname }}"
register: hashed_name
# 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 {% if keystone_service_internaluri_insecure | bool %}--insecure {% endif %}--l3-agent-migrate"
sleep_time: "{{ hashed_name.int_value }}"
- name: Implement openrc/clouds.yaml
include_role:
name: "openstack_openrc"
- name: Implement the Neutron HA job script
template:
src: "neutron_ha_tool.sh.j2"
dest: "/opt/neutron-ha-tool.sh"
owner: "root"
group: "root"
mode: "0755"
- name: Create Neutron HA
cron:
name: "neutron-ha-tool"
minute: "*/1"
day: "*"
hour: "*"
month: "*"
state: "{{ (neutron_legacy_ha_tool_enabled | bool) | ternary('present', 'absent') }}"
job: "/opt/neutron-ha-tool.sh"
user: root
cron_file: "neutron-ha-tool"
- name: Remove AT&T neutron ha tool when disabled
file:
path: "{{ item }}"
state: "absent"
with_items:
- "/opt/neutron-ha-tool.py"
- "/opt/neutron-ha-tool.sh"
when:
- not neutron_legacy_ha_tool_enabled | bool