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.

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