Cleanup temporary files from the gather script

The permissions rules for /tmp say that only the process
that created a file can delete it, this creates issues
rerunning our gather script because we need to overwrite
the temporary files as a different process. I'm at a loss
as to why we didn't see this before though, maybe the permissions
on /tmp in the images we ship have changed recently.

Regardless instead of needlessly slapping become: true on every
task this patch adds a handler to the common role to go and clean
up files before the ansible process exits.

Change-Id: I9e8c1a8b030da8319941dea6eb129fa59e6c2d48
This commit is contained in:
jkilpatr 2017-08-02 07:34:43 -04:00
parent 2dd7fe17d1
commit 8d1f8e4eda
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,15 @@
---
# Cleanup for gather common
# Required to prevent perms issues
- name: cleanup script
file:
path: /tmp/openstack-config-parser.py
state: absent
become: true
- name: cleanup varsfile
file:
path: /tmp/out.yml
state: absent
become: true

View File

@ -1,6 +1,9 @@
---
- name: Copy config parser script to remote
copy: src=openstack-config-parser.py dest=/tmp/openstack-config-parser.py
notify:
- cleanup script
- cleanup varsfile
- name: Determine if docker is running
shell: docker ps | wc -l