ubuntu.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. - name: Include variables
  2. include_vars:
  3. file: "../../../variables.yml"
  4. - name: Install docker prerequsistes
  5. apt:
  6. pkg:
  7. - apt-transport-https
  8. - ca-certificates
  9. - curl
  10. - software-properties-common
  11. - name: Add docker repo key
  12. shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
  13. - name: add repo for docker for x86_64
  14. shell: echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
  15. when: ansible_architecture == 'x86_64'
  16. - name: add repo for docker for aarch64
  17. shell: echo "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
  18. when: ansible_architecture == 'aarch64'
  19. - name: Update repositories cache
  20. apt:
  21. update_cache: yes
  22. - name: Creates directory
  23. file:
  24. path: /etc/docker
  25. state: directory
  26. - name: Copy file with owner and permissions
  27. ansible.builtin.copy:
  28. src: ../../../repo/docker_daemon.json
  29. dest: /etc/docker/daemon.json
  30. owner: root
  31. group: root
  32. mode: '0644'
  33. - name: install docker
  34. apt:
  35. pkg:
  36. - docker-ce
  37. #install compose:
  38. - name: download compose for x86_64
  39. shell: curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-linux-x86_64 | grep -v sha256 | cut -d '"' -f 4 | wget -O /usr/local/bin/docker-compose -qi -
  40. when: ansible_architecture == 'x86_64'
  41. - name: download compose for aarch64
  42. shell: curl -s https://api.github.com/repos/docker/compose/releases/latest | grep browser_download_url | grep docker-compose-linux-aarch64 | grep -v sha256 | cut -d '"' -f 4 | wget -O /usr/local/bin/docker-compose -qi -
  43. when: ansible_architecture == 'aarch64'
  44. - name: make compose executable
  45. shell: chmod +x /usr/local/bin/docker-compose