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 - include: neutron_l3_ha.yml
when: when:
- neutron_services['neutron-l3-agent']['group'] in group_names - neutron_services['neutron-l3-agent']['group'] in group_names
- neutron_legacy_ha_tool_enabled | bool
tags: tags:
- neutron-config - neutron-config

View File

@ -25,17 +25,23 @@
mode: "0755" mode: "0755"
tags: tags:
- neutron-install - neutron-install
when:
- neutron_legacy_ha_tool_enabled | bool
- name: Convert the hostname to an int - name: Convert the hostname to an int
name2int: name2int:
name: "{{ inventory_hostname }}" name: "{{ inventory_hostname }}"
register: hashed_name 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. # These are used in the Neutron HA Cron job script, and processed in the template.
- name: Creating Job Facts - name: Creating Job Facts
set_fact: set_fact:
do_job: ". /root/openrc && /opt/neutron-ha-tool.py {% if keystone_service_internaluri_insecure | bool %}--insecure {% endif %}--l3-agent-migrate" 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 }}" sleep_time: "{{ hashed_name.int_value }}"
when:
- neutron_legacy_ha_tool_enabled | bool
- name: "Drop Neutron HA job script" - name: "Drop Neutron HA job script"
template: template:
@ -44,6 +50,8 @@
owner: "root" owner: "root"
group: "root" group: "root"
mode: "0755" mode: "0755"
when:
- neutron_legacy_ha_tool_enabled | bool
- name: Create Neutron HA - name: Create Neutron HA
cron: cron:
@ -52,7 +60,17 @@
day: "*" day: "*"
hour: "*" hour: "*"
month: "*" month: "*"
state: present state: "{{ (neutron_legacy_ha_tool_enabled | bool) | ternary('present', 'absent') }}"
job: "/opt/neutron-ha-tool.sh" job: "/opt/neutron-ha-tool.sh"
user: root user: root
cron_file: "neutron-ha-tool" 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