main.yml 3.4 KB

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