From 1887e984a0ec418cea7415f57d8cf345dd6e6bf4 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Tue, 21 Mar 2017 12:31:47 +0300 Subject: [PATCH] Change wait for dnsmasq to skip if there are no kube-nodes in play Also changed unnecessary delay to a max timeout (now defaulting to 1s sleep between tries) Also rename play_hosts to ansible_play_hosts --- roles/dnsmasq/tasks/main.yml | 4 ++-- roles/kubernetes/secrets/tasks/check-tokens.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/dnsmasq/tasks/main.yml b/roles/dnsmasq/tasks/main.yml index d6112fd6e..887848532 100644 --- a/roles/dnsmasq/tasks/main.yml +++ b/roles/dnsmasq/tasks/main.yml @@ -77,6 +77,6 @@ wait_for: host: "{{dns_server}}" port: 53 - delay: 5 - when: inventory_hostname == groups['kube-node'][0] + timeout: 180 + when: inventory_hostname == groups['kube-node'][0] and groups['kube-node'][0] in ansible_play_hosts diff --git a/roles/kubernetes/secrets/tasks/check-tokens.yml b/roles/kubernetes/secrets/tasks/check-tokens.yml index 94ee92fb5..497bc7caf 100644 --- a/roles/kubernetes/secrets/tasks/check-tokens.yml +++ b/roles/kubernetes/secrets/tasks/check-tokens.yml @@ -27,7 +27,7 @@ sync_tokens: true when: >- {%- set tokens = {'sync': False} -%} - {%- for server in groups['kube-master'] | intersect(play_hosts) + {%- for server in groups['kube-master'] | intersect(ansible_play_hosts) if (not hostvars[server].known_tokens.stat.exists) or (hostvars[server].known_tokens.stat.checksum != known_tokens_master.stat.checksum|default('')) -%} {%- set _ = tokens.update({'sync': True}) -%}