Skip to content

Commit

Permalink
Clean up cron if l3ha legacy tool is not enabled
Browse files Browse the repository at this point in the history
Related-Bug: 1687447
Change-Id: I13a5d6d0153174959196b6a35f3c79826a15d69c
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
  • Loading branch information
cloudnull authored and Jesse Pretorius (odyssey4me) committed May 4, 2017
1 parent 272da3a commit ccbe248
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion tasks/main.yml
Expand Up @@ -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

Expand Down
20 changes: 19 additions & 1 deletion tasks/neutron_l3_ha.yml
Expand Up @@ -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:
Expand All @@ -44,6 +50,8 @@
owner: "root"
group: "root"
mode: "0755"
when:
- neutron_legacy_ha_tool_enabled | bool

- name: Create Neutron HA
cron:
Expand All @@ -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

0 comments on commit ccbe248

Please sign in to comment.