race condition in download role under vagrant

using a shared folder can cause race conditions for the download
role as it tries to download files on all the nodes to the same
shared path.  This adds a flag to run the tasks in the download
role on just one node.
This commit is contained in:
Paul Czarkowski
2016-05-17 23:30:01 -05:00
parent 5240465f39
commit ba615ff94e
4 changed files with 14 additions and 54 deletions

View File

@@ -1,6 +1,9 @@
---
local_release_dir: /tmp
# if this is set to true will only download files once
download_run_once: False
# Versions
kube_version: "v1.2.4"
etcd_version: v2.2.5

View File

@@ -2,6 +2,7 @@
- name: Create dest directories
file: path={{local_release_dir}}/{{item.dest|dirname}} state=directory recurse=yes
with_items: "{{ downloads }}"
run_once: "{{ download_run_once|bool }}"
- name: Download items
get_url:
@@ -11,6 +12,7 @@
owner: "{{ item.owner|default(omit) }}"
mode: "{{ item.mode|default(omit) }}"
with_items: "{{ downloads }}"
run_once: "{{ download_run_once|bool }}"
- name: Extract archives
unarchive:
@@ -21,6 +23,7 @@
copy: no
when: "{{item.unarchive is defined and item.unarchive == True}}"
with_items: "{{ downloads }}"
run_once: "{{ download_run_once|bool }}"
- name: Fix permissions
file:
@@ -30,3 +33,4 @@
mode: "{{ item.mode|default(omit) }}"
when: "{{item.unarchive is not defined or item.unarchive == False}}"
with_items: "{{ downloads }}"
run_once: "{{ download_run_once|bool }}"