diff options
Diffstat (limited to 'roles/kubernetes/net/kubeguard/node/tasks/main.yml')
-rw-r--r-- | roles/kubernetes/net/kubeguard/node/tasks/main.yml | 31 |
1 files changed, 2 insertions, 29 deletions
diff --git a/roles/kubernetes/net/kubeguard/node/tasks/main.yml b/roles/kubernetes/net/kubeguard/node/tasks/main.yml index 0658b42c..72814e06 100644 --- a/roles/kubernetes/net/kubeguard/node/tasks/main.yml +++ b/roles/kubernetes/net/kubeguard/node/tasks/main.yml @@ -44,35 +44,8 @@ state: started enabled: yes -- name: get list of currently installed kubeguard peers - find: - path: /etc/systemd/system/ - pattern: "kubeguard-peer-*.service" - register: kubeguard_peers_installed - -- name: compute list of peers to be added - set_fact: - kubeguard_peers_to_add: "{{ groups['_kubernetes_nodes_'] | difference(inventory_hostname) }}" - -- name: compute list of peers to be removed - set_fact: - kubeguard_peers_to_remove: "{{ kubeguard_peers_installed.files | map(attribute='path') | map('replace', '/etc/systemd/system/kubeguard-peer-', '') | map('replace', '.service', '') | difference(kubeguard_peers_to_add) }}" - -- name: stop/disable systemd units for stale kubeguard peers - loop: "{{ kubeguard_peers_to_remove }}" - systemd: - name: "kubeguard-peer-{{ item }}.service" - state: stopped - enabled: no - -- name: remove systemd units for stale kubeguard peers - loop: "{{ kubeguard_peers_to_remove }}" - file: - name: "/etc/systemd/system/kubeguard-peer-{{ item }}.service" - state: absent - - name: install systemd units for every kubeguard peer - loop: "{{ kubeguard_peers_to_add }}" + loop: "{{ groups['_kubernetes_nodes_'] | difference(inventory_hostname) }}" loop_control: loop_var: peer template: @@ -81,7 +54,7 @@ # TODO: notify restart for peers that change... - name: make sure kubeguard peer services are started and enabled - loop: "{{ kubeguard_peers_to_add }}" + loop: "{{ groups['_kubernetes_nodes_'] | difference(inventory_hostname) }}" systemd: daemon_reload: yes name: "kubeguard-peer-{{ item }}.service" |