main.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. yum_repository:
  17. name: kubernetes
  18. description: kubernetes
  19. baseurl: https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
  20. enabled: yes
  21. gpgcheck: no
  22. repo_gpgcheck: no
  23. gpgkey:
  24. - https://packages.cloud.google.com/yum/doc/yum-key.gpg
  25. - https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
  26. tags: install
  27. - name: Update sysctl to handle incorrectly routed traffic when iptables is bypassed
  28. copy:
  29. src: k8s.conf
  30. dest: "{{ k8s_conf_dest }}"
  31. owner: root
  32. group: root
  33. mode: "{{ k8s_conf_file_mode }}"
  34. tags: install
  35. - name: Update sysctl
  36. command: /sbin/sysctl --system
  37. changed_when: true
  38. tags: install
  39. - name: Install k8s packages
  40. package:
  41. name: "{{ k8s_packages }}"
  42. state: present
  43. tags: install
  44. - name: Versionlock kubernetes
  45. command: "yum versionlock '{{ item }}'"
  46. args:
  47. warn: false
  48. with_items:
  49. - "{{ k8s_packages }}"
  50. changed_when: true
  51. tags: install
  52. - name: Start and enable docker service
  53. service:
  54. name: docker
  55. state: restarted
  56. enabled: yes
  57. tags: install
  58. - name: Start and enable kubernetes - kubelet
  59. service:
  60. name: kubelet
  61. state: restarted
  62. enabled: yes