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.

136 lines
4.9 KiB

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