main.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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: add kubernetes repo
  16. copy: src=kubernetes.repo dest=/etc/yum.repos.d/ owner=root group=root mode=644
  17. tags: install
  18. # add ElRepo GPG Key
  19. - rpm_key:
  20. state: present
  21. key: https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  22. tags: install
  23. - name: add ElRepo (Nvidia kmod drivers)
  24. yum:
  25. name: http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
  26. state: present
  27. tags: install
  28. - name: update sysctl to handle incorrectly routed traffic when iptables is bypassed
  29. copy: src=k8s.conf dest=/etc/sysctl.d/ owner=root group=root mode=644
  30. tags: install
  31. - name: update sysctl
  32. command: /sbin/sysctl --system
  33. tags: install
  34. - name: Install EPEL Repository
  35. yum: name=epel-release state=present
  36. tags: install
  37. #likely need to add a reboot hook in here
  38. #- name: update kernel and all other system packages
  39. #yum: name=* state=latest
  40. #tags: install
  41. - name: disable swap
  42. command: /sbin/swapoff -a
  43. tags: install
  44. # Disable selinux
  45. - selinux:
  46. state: disabled
  47. tags: install
  48. - name: install common packages
  49. yum:
  50. name:
  51. - yum-plugin-versionlock
  52. - gcc
  53. - nfs-utils
  54. - python-pip
  55. - docker
  56. - bash-completion
  57. - kubelet-1.16.7
  58. - kubeadm-1.16.7
  59. - kubectl-1.16.7
  60. - nvidia-detect
  61. state: present
  62. tags: install
  63. - name: versionlock kubernetes
  64. command: yum versionlock kubelet-1.16.7 kubectl-1.16.7 kubeadm-1.16.7
  65. tags: install
  66. - name: install InfiniBand Support
  67. yum:
  68. name: "@Infiniband Support"
  69. state: present
  70. - name: upgrade pip
  71. command: /bin/pip install --upgrade pip
  72. tags: install
  73. #- name: Enable DevicePlugins for all GPU nodes (nvidia-container-runtime-hook)
  74. #copy: src=nvidia dest=/usr/libexec/oci/hooks.d/ owner=root group=root mode=755
  75. #tags: install
  76. - name: Add KUBE_EXTRA_ARGS to enable GPUs
  77. lineinfile:
  78. path: /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf
  79. line: 'Environment="KUBELET_EXTRA_ARGS=--feature-gates=DevicePlugins=true"'
  80. insertbefore: 'KUBELET_KUBECONFIG_ARGS='
  81. tags: install
  82. - name: Start and Enable docker service
  83. service:
  84. name: docker
  85. state: restarted
  86. enabled: yes
  87. tags: install
  88. - name: Start and Enable Kubernetes - kubelet
  89. service:
  90. name: kubelet
  91. state: restarted
  92. enabled: yes
  93. tags: install
  94. - name: Start and rpcbind service
  95. service:
  96. name: rpcbind
  97. state: restarted
  98. enabled: yes
  99. tags: install
  100. - name: Start and nfs-server service
  101. service:
  102. name: nfs-server
  103. state: restarted
  104. enabled: yes
  105. tags: install
  106. - name: Start and nfs-lock service
  107. service:
  108. name: nfs-lock
  109. #state: restarted
  110. enabled: yes
  111. tags: install
  112. - name: Start and nfs-idmap service
  113. service:
  114. name: nfs-idmap
  115. state: restarted
  116. enabled: yes
  117. tags: install