diff --git a/roles/k3s/tasks/config-calico.yml b/roles/k3s/tasks/config-calico.yml index 987ad70f..c9084dd5 100644 --- a/roles/k3s/tasks/config-calico.yml +++ b/roles/k3s/tasks/config-calico.yml @@ -45,30 +45,9 @@ dest: /usr/local/bin/kubectl-calico mode: u=rwx,g=rx,o=rx -- name: Initialize policy existence facts - set_fact: - policy_existence: {} - -- name: Check if Calico global network policies exist - delegate_to: "{{ groups['deployment'][0] }}" - command: kubectl calico get globalnetworkpolicy {{ item }} - register: check_policy - ignore_errors: true - loop: - - default-deny - - allow-ping - changed_when: false - failed_when: false - -- name: Update policy existence facts - set_fact: - policy_existence: "{{ policy_existence | combine({item.item: (item.rc == 0)}) }}" - loop: "{{ check_policy.results }}" - - name: Apply Calico global network policies delegate_to: "{{ groups['deployment'][0] }}" - command: kubectl calico create --filename="{{ role_path }}/files/calico-global-networkpolicy-{{ item }}.yaml" - when: not policy_existence[item] + command: kubectl calico apply --filename="{{ role_path }}/files/calico-global-networkpolicy-{{ item }}.yaml" loop: - default-deny - allow-ping