From dc275641575b112006b25e54aea6ebd5059b7e35 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 11 Jul 2019 19:58:56 -0400 Subject: [PATCH] Limit database tasks to coordinators only Non-coordinators don't need these configurations as they shouldn't run there. --- roles/pvc/tasks/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/pvc/tasks/main.yml b/roles/pvc/tasks/main.yml index 2f3e7bb..79db722 100644 --- a/roles/pvc/tasks/main.yml +++ b/roles/pvc/tasks/main.yml @@ -1,5 +1,10 @@ --- +# Set coordinator state +- set_fact: + is_coordinator: "{% for node in pvc_nodes if node.hostname == inventory_hostname %}{{ node.is_coordinator }}{% endfor %}" + tags: always + # First-run check - name: check if this is a new instance shell: "echo 'bootstrapped' > /etc/pvc-install.pvc" @@ -24,15 +29,18 @@ src: system/blacklist.j2 dest: /etc/modprobe.d/blacklist.conf -# Install base databases +# Install base databases (coordinators only) - include: ceph/main.yml tags: pvc-ceph + when: is_coordinator - include: zookeeper/main.yml tags: pvc-zookeeper + when: is_coordinator - include: patroni/main.yml tags: pvc-patroni + when: is_coordinator # Install core services - include: libvirt/main.yml