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.

122 lines
4.4 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
  50. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  51. roles:
  52. - { role: kubespray-defaults}
  53. - { role: etcd, tags: etcd, etcd_cluster_setup: true, etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}" }
  54. - hosts: k8s-cluster:calico-rr
  55. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  56. roles:
  57. - { role: kubespray-defaults}
  58. - { role: etcd, tags: etcd, etcd_cluster_setup: false, etcd_events_cluster_setup: false }
  59. - hosts: k8s-cluster
  60. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  61. roles:
  62. - { role: kubespray-defaults}
  63. - { role: kubernetes/node, tags: node }
  64. environment: "{{proxy_env}}"
  65. - hosts: kube-master
  66. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  67. roles:
  68. - { role: kubespray-defaults}
  69. - { role: kubernetes/master, tags: master }
  70. - { role: kubernetes/client, tags: client }
  71. - { role: kubernetes-apps/cluster_roles, tags: cluster-roles }
  72. - hosts: k8s-cluster
  73. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  74. roles:
  75. - { role: kubespray-defaults}
  76. - { role: kubernetes/kubeadm, tags: kubeadm, when: "kubeadm_enabled" }
  77. - { role: network_plugin, tags: network }
  78. - hosts: kube-master[0]
  79. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  80. roles:
  81. - { role: kubespray-defaults}
  82. - { role: kubernetes-apps/rotate_tokens, tags: rotate_tokens, when: "secret_changed|default(false)" }
  83. - { role: win_nodes/kubernetes_patch, tags: win_nodes, when: "kubeadm_enabled" }
  84. - hosts: kube-master
  85. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  86. roles:
  87. - { role: kubespray-defaults}
  88. - { role: kubernetes-apps/network_plugin, tags: network }
  89. - { role: kubernetes-apps/policy_controller, tags: policy-controller }
  90. - { role: kubernetes-apps/ingress_controller, tags: ingress-controller }
  91. - { role: kubernetes-apps/external_provisioner, tags: external-provisioner }
  92. - hosts: calico-rr
  93. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  94. roles:
  95. - { role: kubespray-defaults}
  96. - { role: network_plugin/calico/rr, tags: network }
  97. - hosts: k8s-cluster
  98. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  99. roles:
  100. - { role: kubespray-defaults}
  101. - { role: dnsmasq, when: "dns_mode == 'dnsmasq_kubedns'", tags: dnsmasq }
  102. - { role: kubernetes/preinstall, when: "dns_mode != 'none' and resolvconf_mode == 'host_resolvconf'", tags: resolvconf, dns_late: true }
  103. environment: "{{proxy_env}}"
  104. - hosts: kube-master
  105. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  106. roles:
  107. - { role: kubespray-defaults}
  108. - { role: kubernetes-apps, tags: apps }