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: Collect host facts (including acclerator information)
  25. setup: ~
  26. - name: Add kubernetes repo
  27. copy:
  28. src: kubernetes.repo
  29. dest: "{{ k8s_repo_dest }}"
  30. owner: root
  31. group: root
  32. mode: "{{ k8s_repo_file_mode }}"
  33. tags: install
  34. - name: Add elrepo GPG key
  35. rpm_key:
  36. state: present
  37. key: "{{ elrepo_gpg_key_url }}"
  38. tags: install
  39. - name: Add elrepo (nvidia kmod drivers)
  40. package:
  41. name: "{{ elrepo_rpm_url }}"
  42. state: present
  43. tags: install
  44. - name: Add docker community edition repository
  45. get_url:
  46. url: "{{ docker_repo_url }}"
  47. dest: "{{ docker_repo_dest }}"
  48. tags: install
  49. - name: Update sysctl to handle incorrectly routed traffic when iptables is bypassed
  50. copy:
  51. src: k8s.conf
  52. dest: "{{ k8s_conf_dest }}"
  53. owner: root
  54. group: root
  55. mode: "{{ k8s_conf_file_mode }}"
  56. tags: install
  57. - name: Update sysctl
  58. command: /sbin/sysctl --system
  59. changed_when: true
  60. tags: install
  61. - name: Disable swap
  62. command: /sbin/swapoff -a
  63. changed_when: true
  64. tags: install
  65. - name: Disable selinux
  66. selinux:
  67. state: disabled
  68. tags: install
  69. - name: Install common packages
  70. package:
  71. name: "{{ common_packages }}"
  72. state: present
  73. tags: install
  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: {{ hostvars.host.ansible_local.inventory.nvidia_gpu }} > 0