main.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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: Add docker community edition repository
  24. get_url:
  25. url: "{{ docker_repo_url }}"
  26. dest: "{{ docker_repo_dest }}"
  27. tags: install
  28. - name: Update sysctl to handle incorrectly routed traffic when iptables is bypassed
  29. copy:
  30. src: k8s.conf
  31. dest: "{{ k8s_conf_dest }}"
  32. owner: root
  33. group: root
  34. mode: "{{ k8s_conf_file_mode }}"
  35. tags: install
  36. - name: Update sysctl
  37. command: /sbin/sysctl --system
  38. changed_when: true
  39. tags: install
  40. - name: Install docker
  41. package:
  42. name: docker-ce
  43. state: present
  44. tags: install
  45. - name: Install k8s packages
  46. package:
  47. name: "{{ k8s_packages }}"
  48. state: present
  49. tags: install
  50. - name: Versionlock kubernetes
  51. command: "yum versionlock '{{ item }}'"
  52. args:
  53. warn: false
  54. with_items:
  55. - "{{ k8s_packages }}"
  56. changed_when: true
  57. tags: install
  58. - name: Start and enable docker service
  59. service:
  60. name: docker
  61. state: restarted
  62. enabled: yes
  63. tags: install
  64. - name: Start and enable kubernetes - kubelet
  65. service:
  66. name: kubelet
  67. state: restarted
  68. enabled: yes