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.

126 lines
4.7 KiB

9 years ago
9 years ago
9 years ago
  1. ---
  2. - hosts: localhost
  3. gather_facts: False
  4. roles:
  5. - { role: kubespray-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: kubespray-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. pre_tasks:
  23. - name: gather facts from all instances
  24. setup:
  25. delegate_to: "{{item}}"
  26. delegate_facts: True
  27. with_items: "{{ groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]) }}"
  28. - hosts: k8s-cluster:etcd:calico-rr
  29. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  30. roles:
  31. - { role: kubespray-defaults}
  32. - { role: kubernetes/preinstall, tags: preinstall }
  33. - { role: docker, tags: docker, when: container_manager == 'docker' }
  34. - { role: cri-o, tags: crio, when: container_manager == 'crio' }
  35. - role: rkt
  36. tags: rkt
  37. when: "'rkt' in [etcd_deployment_type, kubelet_deployment_type, vault_deployment_type]"
  38. - { role: download, tags: download, when: "not skip_downloads" }
  39. environment: "{{proxy_env}}"
  40. - hosts: etcd:k8s-cluster:vault:calico-rr
  41. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  42. roles:
  43. - { role: kubespray-defaults, when: "cert_management == 'vault'" }
  44. - { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" }
  45. environment: "{{proxy_env}}"
  46. - hosts: etcd
  47. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  48. roles:
  49. - { role: kubespray-defaults}
  50. - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
  51. - hosts: k8s-cluster:calico-rr
  52. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  53. roles:
  54. - { role: kubespray-defaults}
  55. - { role: etcd, tags: etcd, etcd_cluster_setup: false, etcd_events_cluster_setup: false }
  56. - hosts: etcd:k8s-cluster:vault:calico-rr
  57. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  58. roles:
  59. - { role: kubespray-defaults}
  60. - { role: vault, tags: vault, when: "cert_management == 'vault'"}
  61. environment: "{{proxy_env}}"
  62. - hosts: k8s-cluster
  63. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  64. roles:
  65. - { role: kubespray-defaults}
  66. - { role: kubernetes/node, tags: node }
  67. environment: "{{proxy_env}}"
  68. - hosts: kube-master
  69. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  70. roles:
  71. - { role: kubespray-defaults}
  72. - { role: kubernetes/master, tags: master }
  73. - { role: kubernetes/client, tags: client }
  74. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  75. - hosts: k8s-cluster
  76. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  77. roles:
  78. - { role: kubespray-defaults}
  79. - { role: kubernetes/kubeadm, tags: kubeadm, when: "kubeadm_enabled" }
  80. - { role: network_plugin, tags: network }
  81. - hosts: kube-master[0]
  82. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  83. roles:
  84. - { role: kubespray-defaults}
  85. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  86. - { role: win_nodes/kubernetes_patch, tags: win_nodes, when: "kubeadm_enabled" }
  87. - hosts: kube-master
  88. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  89. roles:
  90. - { role: kubespray-defaults}
  91. - { role: kubernetes-apps/network_plugin, tags: network }
  92. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  93. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  94. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  95. - hosts: calico-rr
  96. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  97. roles:
  98. - { role: kubespray-defaults}
  99. - { role: network_plugin/calico/rr, tags: network }
  100. - hosts: k8s-cluster
  101. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  102. roles:
  103. - { role: kubespray-defaults}
  104. - { role: dnsmasq, when: "dns_mode == 'dnsmasq_kubedns'", tags: dnsmasq }
  105. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf }
  106. environment: "{{proxy_env}}"
  107. - hosts: kube-master
  108. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  109. roles:
  110. - { role: kubespray-defaults}
  111. - { role: kubernetes-apps, tags: apps }