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.

72 lines
2.6 KiB

  1. ---
  2. - hosts: localhost
  3. gather_facts: False
  4. become: no
  5. tasks:
  6. - name: "Check ansible version >=2.7.8"
  7. assert:
  8. msg: "Ansible must be v2.7.8 or higher"
  9. that:
  10. - ansible_version.string is version("2.7.8", ">=")
  11. tags:
  12. - check
  13. vars:
  14. ansible_connection: local
  15. - hosts: all
  16. gather_facts: false
  17. tasks:
  18. - name: "Set up proxy environment"
  19. set_fact:
  20. proxy_env:
  21. http_proxy: "{{ http_proxy | default ('') }}"
  22. HTTP_PROXY: "{{ http_proxy | default ('') }}"
  23. https_proxy: "{{ https_proxy | default ('') }}"
  24. HTTPS_PROXY: "{{ https_proxy | default ('') }}"
  25. no_proxy: "{{ no_proxy | default ('') }}"
  26. NO_PROXY: "{{ no_proxy | default ('') }}"
  27. no_log: true
  28. - hosts: bastion[0]
  29. gather_facts: False
  30. roles:
  31. - { role: kubespray-defaults }
  32. - { role: bastion-ssh-config, tags: ["localhost", "bastion"] }
  33. - name: Bootstrap any new workers
  34. hosts: kube-node
  35. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  36. gather_facts: false
  37. roles:
  38. - { role: kubespray-defaults }
  39. - { role: bootstrap-os, tags: bootstrap-os}
  40. - name: Generate the etcd certificates beforehand
  41. hosts: etcd
  42. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  43. roles:
  44. - { role: kubespray-defaults }
  45. - { role: etcd, tags: etcd, etcd_cluster_setup: false }
  46. - name: Download images to ansible host cache via first kube-master node
  47. hosts: kube-master[0]
  48. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  49. roles:
  50. - { role: kubespray-defaults, when: "not skip_downloads and download_run_once and not download_localhost"}
  51. - { role: kubernetes/preinstall, tags: preinstall, when: "not skip_downloads and download_run_once and not download_localhost" }
  52. - { role: download, tags: download, when: "not skip_downloads and download_run_once and not download_localhost" }
  53. - name: Target only workers to get kubelet installed and checking in on any new nodes
  54. hosts: kube-node
  55. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  56. roles:
  57. - { role: kubespray-defaults }
  58. - { role: kubernetes/preinstall, tags: preinstall }
  59. - { role: container-engine, tags: "container-engine", when: deploy_container_engine|default(true) }
  60. - { role: download, tags: download, when: "not skip_downloads" }
  61. - { role: etcd, tags: etcd, etcd_cluster_setup: false, when: "not etcd_kubeadm_enabled|default(false)" }
  62. - { role: kubernetes/node, tags: node }
  63. - { role: kubernetes/kubeadm, tags: kubeadm }
  64. - { role: network_plugin, tags: network }
  65. - { role: kubernetes/node-label, tags: node-label }
  66. environment: "{{ proxy_env }}"