github.com/jlmeeker/kismatic@v1.10.1-0.20180612190640-57f9005a1f1a/ansible/roles/calico-network-policy/tasks/main.yaml (about) 1 --- 2 - name: create {{ calico_dir }} directory 3 file: 4 path: "{{ calico_dir }}" 5 state: directory 6 - name: copy network-policy-controller.yaml to remote 7 template: 8 src: network-policy-controller.yaml 9 dest: "{{ calico_dir }}/network-policy-controller.yaml" 10 - name: start calico policy controller 11 command: kubectl --kubeconfig {{ kubernetes_kubeconfig.kubectl }} apply -f {{ calico_dir }}/network-policy-controller.yaml 12 register: out 13 14 - name: wait until policy controller pods are ready 15 command: kubectl --kubeconfig {{ kubernetes_kubeconfig.kubectl }} get deployment calico-kube-controllers -n kube-system -o jsonpath='{.status.availableReplicas}' 16 register: readyReplicas 17 until: readyReplicas.stdout|int == 1 18 retries: 24 19 delay: 10 20 failed_when: false # We don't want this task to actually fail (We catch the failure with a custom msg in the next task) 21 - name: fail if any policy controller pods are not ready 22 fail: 23 msg: "Timed out waiting for policy controller pods to be in the ready state." 24 when: readyReplicas.stdout|int != 1 25 - debug: var=out.stdout_lines 26 27 - debug: var=out.stdout_lines