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.

108 lines
3.8 KiB

  1. ---
  2. - hosts: localhost
  3. gather_facts: False
  4. roles:
  5. - { role: kargo-defaults}
  6. - { role: bastion-ssh-config, tags: ["localhost", "bastion"]}
  7. - hosts: k8s-cluster:etcd:calico-rr
  8. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  9. gather_facts: false
  10. vars:
  11. # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
  12. # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
  13. ansible_ssh_pipelining: false
  14. roles:
  15. - { role: kargo-defaults}
  16. - { role: bootstrap-os, tags: bootstrap-os}
  17. - hosts: k8s-cluster:etcd:calico-rr
  18. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  19. vars:
  20. ansible_ssh_pipelining: true
  21. gather_facts: true
  22. - hosts: k8s-cluster:etcd:calico-rr
  23. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  24. roles:
  25. - { role: kargo-defaults}
  26. - { role: kernel-upgrade, tags: kernel-upgrade, when: kernel_upgrade is defined and kernel_upgrade }
  27. - { role: kubernetes/preinstall, tags: preinstall }
  28. - { role: docker, tags: docker }
  29. - role: rkt
  30. tags: rkt
  31. when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]"
  32. - hosts: etcd:k8s-cluster:vault
  33. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  34. roles:
  35. - { role: kargo-defaults, when: "cert_management == 'vault'" }
  36. - { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" }
  37. - hosts: etcd
  38. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  39. roles:
  40. - { role: kargo-defaults}
  41. - { role: etcd, tags: etcd, etcd_cluster_setup: true }
  42. - hosts: k8s-cluster
  43. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  44. roles:
  45. - { role: kargo-defaults}
  46. - { role: etcd, tags: etcd, etcd_cluster_setup: false }
  47. - hosts: etcd:k8s-cluster:vault
  48. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  49. roles:
  50. - { role: kargo-defaults, when: "cert_management == 'vault'"}
  51. - { role: vault, tags: vault, when: "cert_management == 'vault'"}
  52. #Handle upgrades to master components first to maintain backwards compat.
  53. - hosts: kube-master
  54. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  55. serial: 1
  56. roles:
  57. - { role: kargo-defaults}
  58. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  59. - { role: kubernetes/node, tags: node }
  60. - { role: kubernetes/master, tags: master }
  61. - { role: network_plugin, tags: network }
  62. - { role: upgrade/post-upgrade, tags: post-upgrade }
  63. #Finally handle worker upgrades, based on given batch size
  64. - hosts: kube-node:!kube-master
  65. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  66. serial: "{{ serial | default('20%') }}"
  67. roles:
  68. - { role: kargo-defaults}
  69. - { role: upgrade/pre-upgrade, tags: pre-upgrade }
  70. - { role: kubernetes/node, tags: node }
  71. - { role: network_plugin, tags: network }
  72. - { role: upgrade/post-upgrade, tags: post-upgrade }
  73. - { role: kargo-defaults}
  74. - hosts: kube-master
  75. any_errors_fatal: true
  76. roles:
  77. - { role: kargo-defaults}
  78. - { role: kubernetes-apps/network_plugin, tags: network }
  79. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  80. - hosts: calico-rr
  81. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  82. roles:
  83. - { role: kargo-defaults}
  84. - { role: network_plugin/calico/rr, tags: network }
  85. - hosts: k8s-cluster
  86. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  87. roles:
  88. - { role: kargo-defaults}
  89. - { role: dnsmasq, when: "dns_mode == 'dnsmasq_kubedns'", tags: dnsmasq }
  90. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf }
  91. - hosts: kube-master[0]
  92. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  93. roles:
  94. - { role: kargo-defaults}
  95. - { role: kubernetes-apps, tags: apps }