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:
15
ansible/gather/roles/common/handlers/main.yml
Normal file
15
ansible/gather/roles/common/handlers/main.yml
Normal 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
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
- name: Copy config parser script to remote
|
- name: Copy config parser script to remote
|
||||||
copy: src=openstack-config-parser.py dest=/tmp/openstack-config-parser.py
|
copy: src=openstack-config-parser.py dest=/tmp/openstack-config-parser.py
|
||||||
|
notify:
|
||||||
|
- cleanup script
|
||||||
|
- cleanup varsfile
|
||||||
|
|
||||||
- name: Determine if docker is running
|
- name: Determine if docker is running
|
||||||
shell: docker ps | wc -l
|
shell: docker ps | wc -l
|
||||||
|
|||||||
Reference in New Issue
Block a user