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.

77 lines
2.7 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: Gather facts
  41. import_playbook: facts.yml
  42. - name: Generate the etcd certificates beforehand
  43. hosts: etcd
  44. gather_facts: False
  45. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  46. roles:
  47. - { role: kubespray-defaults }
  48. - { role: etcd, tags: etcd, etcd_cluster_setup: false }
  49. - name: Download images to ansible host cache via first kube-master node
  50. hosts: kube-master[0]
  51. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  52. roles:
  53. - { role: kubespray-defaults, when: "not skip_downloads and download_run_once and not download_localhost"}
  54. - { role: kubernetes/preinstall, tags: preinstall, when: "not skip_downloads and download_run_once and not download_localhost" }
  55. - { role: download, tags: download, when: "not skip_downloads and download_run_once and not download_localhost" }
  56. - name: Target only workers to get kubelet installed and checking in on any new nodes
  57. hosts: kube-node
  58. gather_facts: False
  59. any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
  60. roles:
  61. - { role: kubespray-defaults }
  62. - { role: kubernetes/preinstall, tags: preinstall }
  63. - { role: container-engine, tags: "container-engine", when: deploy_container_engine|default(true) }
  64. - { role: download, tags: download, when: "not skip_downloads" }
  65. - { role: etcd, tags: etcd, etcd_cluster_setup: false, when: "not etcd_kubeadm_enabled|default(false)" }
  66. - { role: kubernetes/node, tags: node }
  67. - { role: kubernetes/kubeadm, tags: kubeadm }
  68. - { role: network_plugin, tags: network }
  69. - { role: kubernetes/node-label, tags: node-label }
  70. environment: "{{ proxy_env }}"