Ansible_PUBLIC/roles/docker_host/tasks/ubuntu.yml

57 lines
1.9 KiB
YAML

- name: Include variables
include_vars:
file: "../../../variables.yml"
- name: Install docker prerequsistes
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- name: Add docker repo key
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
- name: add repo for docker for x86_64
shell: echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
when: ansible_architecture == 'x86_64'
- name: add repo for docker for aarch64
shell: echo "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list
when: ansible_architecture == 'aarch64'
- name: Update repositories cache
apt:
update_cache: yes
- name: Creates directory
file:
path: /etc/docker
state: directory
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: ../../../repo/docker_daemon.json
dest: /etc/docker/daemon.json
owner: root
group: root
mode: '0644'
- name: install docker
apt:
pkg:
- docker-ce
#install compose:
- name: download compose for x86_64
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 -
when: ansible_architecture == 'x86_64'
- name: download compose for aarch64
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 -
when: ansible_architecture == 'aarch64'
- name: make compose executable
shell: chmod +x /usr/local/bin/docker-compose