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.

71 lines
2.9 KiB

  1. ---
  2. - name: Kubernetes Apps | Check if netchecker-server manifest already exists
  3. stat:
  4. path: "{{ kube_config_dir }}/netchecker-server-deployment.yml"
  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 | Netchecker Templates list
  21. set_fact:
  22. netchecker_templates:
  23. - {file: netchecker-agent-sa.yml, type: sa, name: netchecker-agent}
  24. - {file: netchecker-agent-ds.yml, type: ds, name: netchecker-agent}
  25. - {file: netchecker-agent-hostnet-ds.yml, type: ds, name: netchecker-agent-hostnet}
  26. - {file: netchecker-server-sa.yml, type: sa, name: netchecker-server}
  27. - {file: netchecker-server-clusterrole.yml, type: clusterrole, name: netchecker-server}
  28. - {file: netchecker-server-clusterrolebinding.yml, type: clusterrolebinding, name: netchecker-server}
  29. - {file: netchecker-server-deployment.yml, type: deployment, name: netchecker-server}
  30. - {file: netchecker-server-svc.yml, type: svc, name: netchecker-service}
  31. netchecker_templates_for_psp:
  32. - {file: netchecker-agent-hostnet-psp.yml, type: podsecuritypolicy, name: netchecker-agent-hostnet-policy}
  33. - {file: netchecker-agent-hostnet-clusterrole.yml, type: clusterrole, name: netchecker-agent}
  34. - {file: netchecker-agent-hostnet-clusterrolebinding.yml, type: clusterrolebinding, name: netchecker-agent}
  35. - name: Kubernetes Apps | Append extra templates to Netchecker Templates list for PodSecurityPolicy
  36. set_fact:
  37. netchecker_templates: "{{ netchecker_templates_for_psp + netchecker_templates}}"
  38. when: podsecuritypolicy_enabled
  39. - name: Kubernetes Apps | Lay Down Netchecker Template
  40. template:
  41. src: "{{item.file}}.j2"
  42. dest: "{{kube_config_dir}}/{{item.file}}"
  43. with_items: "{{ netchecker_templates }}"
  44. register: manifests
  45. when:
  46. - inventory_hostname == groups['kube-master'][0]
  47. - name: Kubernetes Apps | Purge old Netchecker server
  48. kube:
  49. name: "netchecker-server"
  50. namespace: "{{ netcheck_namespace }}"
  51. kubectl: "{{bin_dir}}/kubectl"
  52. resource: "po"
  53. state: absent
  54. when: inventory_hostname == groups['kube-master'][0]
  55. - name: Kubernetes Apps | Start Netchecker Resources
  56. kube:
  57. name: "{{item.item.name}}"
  58. namespace: "{{netcheck_namespace}}"
  59. kubectl: "{{bin_dir}}/kubectl"
  60. resource: "{{item.item.type}}"
  61. filename: "{{kube_config_dir}}/{{item.item.file}}"
  62. state: "latest"
  63. with_items: "{{ manifests.results }}"
  64. when: inventory_hostname == groups['kube-master'][0] and not item|skipped