From a7595b9fa989cadf5c3f83cd76133e87383e0119 Mon Sep 17 00:00:00 2001 From: Josh Conant Date: Fri, 10 Mar 2017 01:46:22 +0000 Subject: [PATCH] Removing duplicated roles for calico-rr and sync_file improvement --- cluster.yml | 2 +- roles/network_plugin/calico/rr/meta/main.yml | 3 --- roles/vault/tasks/shared/sync_file.yml | 5 +++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cluster.yml b/cluster.yml index 01b033b2f..5a725de9e 100644 --- a/cluster.yml +++ b/cluster.yml @@ -45,7 +45,7 @@ - { role: kargo-defaults} - { role: etcd, tags: etcd, etcd_cluster_setup: true } -- hosts: k8s-cluster +- hosts: k8s-cluster:calico-rr any_errors_fatal: true roles: - { role: kargo-defaults} diff --git a/roles/network_plugin/calico/rr/meta/main.yml b/roles/network_plugin/calico/rr/meta/main.yml index 55104953e..63f761a87 100644 --- a/roles/network_plugin/calico/rr/meta/main.yml +++ b/roles/network_plugin/calico/rr/meta/main.yml @@ -1,6 +1,3 @@ dependencies: - - role: etcd - - role: docker - when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] - role: download file: "{{ downloads.calico_rr }}" diff --git a/roles/vault/tasks/shared/sync_file.yml b/roles/vault/tasks/shared/sync_file.yml index 484d4aced..68a6be2ac 100644 --- a/roles/vault/tasks/shared/sync_file.yml +++ b/roles/vault/tasks/shared/sync_file.yml @@ -30,13 +30,14 @@ register: sync_file_key_stat when: sync_file_is_cert|d() +# .get() is used for situations where not all nodes in sync_file_srcs are included in current play - name: "sync_file | Combine all possible file sync sources" set_fact: sync_file_srcs: "{{ sync_file_srcs|default([]) + [host_item] }}" with_items: "{{ sync_file_hosts | unique }}" loop_control: loop_var: host_item - when: hostvars[host_item]["sync_file_stat"]["stat"]["exists"]|bool + when: hostvars[host_item].get("sync_file_stat", {}).get("stat", {}).get("exists") | bool - name: "sync_file | Combine all possible key file sync sources" set_fact: @@ -44,7 +45,7 @@ with_items: "{{ sync_file_hosts | unique }}" loop_control: loop_var: host_item - when: sync_file_is_cert|d() and hostvars[host_item]["sync_file_key_stat"]["stat"]["exists"]|bool + when: sync_file_is_cert|d() and hostvars[host_item].get("sync_file_key_stat", {}).get("stat", {}).get("exists") | bool - name: "sync_file | Remove sync sources with files that do not match sync_file_srcs|first" set_fact: