You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.2 KiB

  1. ---
  2. - name: Kubernetes Apps | Check if netchecker-server manifest already exists
  3. stat:
  4. path: "{{ kube_config_dir }}/netchecker-server-deployment.yml.j2"
  5. register: netchecker_server_manifest
  6. tags:
  7. - facts
  8. - upgrade
  9. - name: Kubernetes Apps | Apply netchecker-server manifest to update annotations
  10. kube:
  11. name: "netchecker-server"
  12. namespace: "{{ netcheck_namespace }}"
  13. filename: "{{ netchecker_server_manifest.stat.path }}"
  14. kubectl: "{{bin_dir}}/kubectl"
  15. resource: "deploy"
  16. state: latest
  17. when: inventory_hostname == groups['kube-master'][0] and netchecker_server_manifest.stat.exists
  18. tags:
  19. - upgrade
  20. - name: Kubernetes Apps | Lay Down Netchecker Template
  21. template:
  22. src: "{{item.file}}"
  23. dest: "{{kube_config_dir}}/{{item.file}}"
  24. with_items:
  25. - {file: netchecker-agent-ds.yml.j2, type: ds, name: netchecker-agent}
  26. - {file: netchecker-agent-hostnet-ds.yml.j2, type: ds, name: netchecker-agent-hostnet}
  27. - {file: netchecker-server-sa.yml.j2, type: sa, name: netchecker-server}
  28. - {file: netchecker-server-clusterrole.yml.j2, type: clusterrole, name: netchecker-server}
  29. - {file: netchecker-server-clusterrolebinding.yml.j2, type: clusterrolebinding, name: netchecker-server}
  30. - {file: netchecker-server-deployment.yml.j2, type: deployment, name: netchecker-server}
  31. - {file: netchecker-server-svc.yml.j2, type: svc, name: netchecker-service}
  32. register: manifests
  33. when:
  34. - inventory_hostname == groups['kube-master'][0]
  35. - rbac_enabled or item.type not in rbac_resources
  36. - name: Kubernetes Apps | Purge old Netchecker server
  37. kube:
  38. name: "netchecker-server"
  39. namespace: "{{ netcheck_namespace }}"
  40. kubectl: "{{bin_dir}}/kubectl"
  41. resource: "po"
  42. state: absent
  43. when: inventory_hostname == groups['kube-master'][0]
  44. - name: Kubernetes Apps | Start Netchecker Resources
  45. kube:
  46. name: "{{item.item.name}}"
  47. namespace: "{{netcheck_namespace}}"
  48. kubectl: "{{bin_dir}}/kubectl"
  49. resource: "{{item.item.type}}"
  50. filename: "{{kube_config_dir}}/{{item.item.file}}"
  51. state: "latest"
  52. with_items: "{{ manifests.results }}"
  53. when: inventory_hostname == groups['kube-master'][0] and not item|skipped