diff --git a/install_docker.yml b/install_docker.yml new file mode 100644 index 0000000..dfd7c79 --- /dev/null +++ b/install_docker.yml @@ -0,0 +1,32 @@ +- 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-get update + + - name: Install certificates & Curl + shell: apt-get 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-get update + + - name: Install Docker + shell: apt-get install 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 \ No newline at end of file