docker_installation.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 docker repo
  16. get_url:
  17. url: "{{ docker_repo_url }}"
  18. dest: "{{ docker_repo_dest }}"
  19. tags: install
  20. - name: Enable docker edge and test repo
  21. ini_file:
  22. dest: "{{ docker_repo_dest }}"
  23. section: "{{ item }}"
  24. option: enabled
  25. value: "{{ success }}"
  26. with_items: ['docker-ce-test', 'docker-ce-edge']
  27. tags: install
  28. - name: Install docker
  29. package:
  30. name: "{{ container_repo_install }}"
  31. state: present
  32. become: yes
  33. tags: install
  34. - name: Start services
  35. service:
  36. name: "{{ container_type }}"
  37. state: started
  38. enabled: yes
  39. become: yes
  40. tags: install
  41. - name: Uninstall docker-py using pip
  42. pip:
  43. name: ['docker-py','docker']
  44. state: absent
  45. tags: install
  46. - name: Install docker using pip
  47. pip:
  48. name: docker
  49. state: present
  50. tags: install
  51. - name: Update pip
  52. command: pip3 install --upgrade pip
  53. changed_when: false
  54. - name: Installation using python3
  55. pip:
  56. name: "{{ docker_compose }}"
  57. executable: pip3
  58. tags: install
  59. - name: Versionlock docker
  60. command: "yum versionlock '{{ item }}'"
  61. args:
  62. warn: false
  63. with_items:
  64. - "{{ container_repo_install }}"
  65. changed_when: true
  66. tags: install
  67. - name: Configure docker
  68. copy:
  69. src: daemon.json
  70. dest: "{{ daemon_dest }}"
  71. tags: install
  72. - name: Restart docker
  73. service:
  74. name: docker
  75. state: restarted