main.yml 1.6 KB

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