Files
awx_update/install_docker.yml
T

32 lines
1.4 KiB
YAML

- name: install docker
hosts: all
tasks:
- name: Remove all previous component
shell: for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do apt-get remove $pkg; done
- name: Update conf package
shell: apt update
- name: Install certificates & Curl
shell: apt install ca-certificates curl
- name: Add Docker's official GPG key
shell: install -m 0755 -d /etc/apt/keyrings
- name: Get keyring
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
- name: Chmod
shell: chmod a+r /etc/apt/keyrings/docker.asc
- name: Add the repository to Apt sources
shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
- name: Update conf package
shell: apt update
- name: Install Docker
shell: apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- name: Install Portainer agent
shell: docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest