Clean up cron if l3ha legacy tool is not enabled

Related-Bug: 1687447
Change-Id: I13a5d6d0153174959196b6a35f3c79826a15d69c
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-05-02 11:21:44 -05:00 committed by Jesse Pretorius (odyssey4me)
parent 272da3a1bf
commit ccbe248b5d
2 changed files with 19 additions and 2 deletions

View File

@ -89,7 +89,6 @@
- include: neutron_l3_ha.yml
when:
- neutron_services['neutron-l3-agent']['group'] in group_names
- neutron_legacy_ha_tool_enabled | bool
tags:
- neutron-config

View File

@ -25,17 +25,23 @@
mode: "0755"
tags:
- neutron-install
when:
- neutron_legacy_ha_tool_enabled | bool
- name: Convert the hostname to an int
name2int:
name: "{{ inventory_hostname }}"
register: hashed_name
when:
- neutron_legacy_ha_tool_enabled | bool
# 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 }}"
when:
- neutron_legacy_ha_tool_enabled | bool
- name: "Drop Neutron HA job script"
template:
@ -44,6 +50,8 @@
owner: "root"
group: "root"
mode: "0755"
when:
- neutron_legacy_ha_tool_enabled | bool
- name: Create Neutron HA
cron:
@ -52,7 +60,17 @@
day: "*"
hour: "*"
month: "*"
state: present
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