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.

124 lines
4.4 KiB

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