main.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Create a custom fact directory on each host
  16. file:
  17. path: /etc/ansible/facts.d
  18. state: directory
  19. - name: Install accelerator discovery script
  20. copy:
  21. src: inventory.fact
  22. dest: /etc/ansible/facts.d/inventory.fact
  23. mode: 0755
  24. - name: Add kubernetes repo
  25. copy:
  26. src: kubernetes.repo
  27. dest: "{{ k8s_repo_dest }}"
  28. owner: root
  29. group: root
  30. mode: "{{ k8s_repo_file_mode }}"
  31. tags: install
  32. - name: Add elrepo GPG key
  33. rpm_key:
  34. state: present
  35. key: "{{ elrepo_gpg_key_url }}"
  36. tags: install
  37. - name: Add elrepo (nvidia kmod drivers)
  38. package:
  39. name: "{{ elrepo_rpm_url }}"
  40. state: present
  41. tags: install
  42. - name: Add docker community edition repository
  43. get_url:
  44. url: "{{ docker_repo_url }}"
  45. dest: "{{ docker_repo_dest }}"
  46. tags: install
  47. - name: Update sysctl to handle incorrectly routed traffic when iptables is bypassed
  48. copy:
  49. src: k8s.conf
  50. dest: "{{ k8s_conf_dest }}"
  51. owner: root
  52. group: root
  53. mode: "{{ k8s_conf_file_mode }}"
  54. tags: install
  55. - name: Update sysctl
  56. command: /sbin/sysctl --system
  57. changed_when: true
  58. tags: install
  59. - name: Disable swap
  60. command: /sbin/swapoff -a
  61. changed_when: true
  62. tags: install
  63. - name: Disable selinux
  64. selinux:
  65. state: disabled
  66. tags: install
  67. - name: Install common packages
  68. package:
  69. name: "{{ common_packages }}"
  70. state: present
  71. tags: install
  72. - name: Collect host facts (including acclerator information)
  73. setup: ~
  74. - name: Install k8s packages
  75. package:
  76. name: "{{ k8s_packages }}"
  77. state: present
  78. tags: install
  79. - name: Versionlock kubernetes
  80. command: "yum versionlock '{{ item }}'"
  81. args:
  82. warn: false
  83. with_items:
  84. - "{{ k8s_packages }}"
  85. changed_when: true
  86. tags: install
  87. - name: Install infiniBand support
  88. package:
  89. name: "@Infiniband Support"
  90. state: present
  91. tags: install
  92. - name: Start and enable docker service
  93. service:
  94. name: docker
  95. state: restarted
  96. enabled: yes
  97. tags: install
  98. - name: Start and enable kubernetes - kubelet
  99. service:
  100. name: kubelet
  101. state: restarted
  102. enabled: yes
  103. - name: Deploy time ntp/chrony
  104. include_tasks: ntp.yml
  105. tags: install
  106. - name: Install Nvidia drivers and software components
  107. include_tasks: nvidia.yml
  108. when: ansible_local.inventory.nvidia_gpu > 0