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.

135 lines
4.9 KiB

9 years ago
9 years ago
9 years ago
  1. ---
  2. - hosts: localhost
  3. tasks:
  4. - name: Check ansible version <2.7
  5. assert:
  6. msg: "Ansible V2.7.0 can't be used until: https://github.com/ansible/ansible/issues/46600 is fixed"
  7. that:
  8. - ansible_version.string is version("2.7.0", "<")
  9. - ansible_version.string is version("2.5.0", ">=")
  10. tags:
  11. - check
  12. vars:
  13. ansible_connection: local
  14. - hosts: bastion[0]
  15. gather_facts: False
  16. roles:
  17. - { role: kubespray-defaults}
  18. - { role: bastion-ssh-config, tags: ["localhost", "bastion"]}
  19. - hosts: k8s-cluster:etcd:calico-rr
  20. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  21. gather_facts: false
  22. vars:
  23. # Need to disable pipelining for bootstrap-os as some systems have requiretty in sudoers set, which makes pipelining
  24. # fail. bootstrap-os fixes this on these systems, so in later plays it can be enabled.
  25. ansible_ssh_pipelining: false
  26. roles:
  27. - { role: kubespray-defaults}
  28. - { role: bootstrap-os, tags: bootstrap-os}
  29. - hosts: k8s-cluster:etcd:calico-rr
  30. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  31. vars:
  32. ansible_ssh_pipelining: true
  33. gather_facts: true
  34. pre_tasks:
  35. - name: gather facts from all instances
  36. setup:
  37. delegate_to: "{{item}}"
  38. delegate_facts: True
  39. with_items: "{{ groups['k8s-cluster'] + groups['etcd'] + groups['calico-rr']|default([]) }}"
  40. - hosts: k8s-cluster:etcd:calico-rr
  41. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  42. roles:
  43. - { role: kubespray-defaults}
  44. - { role: kubernetes/preinstall, tags: preinstall }
  45. - { role: "container-engine", tags: "container-engine" }
  46. - { role: download, tags: download, when: "not skip_downloads" }
  47. environment: "{{proxy_env}}"
  48. - hosts: etcd:k8s-cluster:vault:calico-rr
  49. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  50. roles:
  51. - { role: kubespray-defaults, when: "cert_management == 'vault'" }
  52. - { role: vault, tags: vault, vault_bootstrap: true, when: "cert_management == 'vault'" }
  53. environment: "{{proxy_env}}"
  54. - hosts: etcd
  55. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  56. roles:
  57. - { role: kubespray-defaults}
  58. - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
  59. - hosts: k8s-cluster:calico-rr
  60. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  61. roles:
  62. - { role: kubespray-defaults}
  63. - { role: etcd, tags: etcd, etcd_cluster_setup: false, etcd_events_cluster_setup: false }
  64. - hosts: etcd:k8s-cluster:vault:calico-rr
  65. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  66. roles:
  67. - { role: kubespray-defaults}
  68. - { role: vault, tags: vault, when: "cert_management == 'vault'"}
  69. environment: "{{proxy_env}}"
  70. - hosts: k8s-cluster
  71. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  72. roles:
  73. - { role: kubespray-defaults}
  74. - { role: kubernetes/node, tags: node }
  75. environment: "{{proxy_env}}"
  76. - hosts: kube-master
  77. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  78. roles:
  79. - { role: kubespray-defaults}
  80. - { role: kubernetes/master, tags: master }
  81. - { role: kubernetes/client, tags: client }
  82. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  83. - hosts: k8s-cluster
  84. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  85. roles:
  86. - { role: kubespray-defaults}
  87. - { role: kubernetes/kubeadm, tags: kubeadm, when: "kubeadm_enabled" }
  88. - { role: network_plugin, tags: network }
  89. - hosts: kube-master[0]
  90. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  91. roles:
  92. - { role: kubespray-defaults}
  93. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  94. - { role: win_nodes/kubernetes_patch, tags: win_nodes, when: "kubeadm_enabled" }
  95. - hosts: kube-master
  96. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  97. roles:
  98. - { role: kubespray-defaults}
  99. - { role: kubernetes-apps/network_plugin, tags: network }
  100. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  101. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  102. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  103. - hosts: calico-rr
  104. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  105. roles:
  106. - { role: kubespray-defaults}
  107. - { role: network_plugin/calico/rr, tags: network }
  108. - hosts: k8s-cluster
  109. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  110. roles:
  111. - { role: kubespray-defaults}
  112. - { role: dnsmasq, when: "dns_mode == 'dnsmasq_kubedns'", tags: dnsmasq }
  113. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf }
  114. environment: "{{proxy_env}}"
  115. - hosts: kube-master
  116. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  117. roles:
  118. - { role: kubespray-defaults}
  119. - { role: kubernetes-apps, tags: apps }